mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-04-06 17:49:11 +03:00
linux: libshare/smb: cache smb_available
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz> Closes #13165
This commit is contained in:
parent
1ec9218faa
commit
086af23e68
@ -378,14 +378,18 @@ const sa_fstype_t libshare_smb_type = {
|
|||||||
static boolean_t
|
static boolean_t
|
||||||
smb_available(void)
|
smb_available(void)
|
||||||
{
|
{
|
||||||
struct stat statbuf;
|
static int avail;
|
||||||
|
|
||||||
if (lstat(SHARE_DIR, &statbuf) != 0 ||
|
if (!avail) {
|
||||||
!S_ISDIR(statbuf.st_mode))
|
struct stat statbuf;
|
||||||
return (B_FALSE);
|
|
||||||
|
|
||||||
if (access(NET_CMD_PATH, F_OK) != 0)
|
if (access(NET_CMD_PATH, F_OK) != 0 ||
|
||||||
return (B_FALSE);
|
lstat(SHARE_DIR, &statbuf) != 0 ||
|
||||||
|
!S_ISDIR(statbuf.st_mode))
|
||||||
|
avail = -1;
|
||||||
|
else
|
||||||
|
avail = 1;
|
||||||
|
}
|
||||||
|
|
||||||
return (B_TRUE);
|
return (avail == 1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user