X-Git-Url: https://git.camperquake.de/gitweb.cgi?a=blobdiff_plain;f=lib%2Flibshare%2Fsmb.c;h=a545bfb0f7d99f8cb5d5efb2611612aa8092e2b1;hb=e34f17a8dfc0ef7650ba489f9772c2c20dc8bec4;hp=e34d14259112a7d7dee3be2e70ec295d986d627b;hpb=645fb9cc214c79c77378dd1e1fd2e3ef668bc848;p=zfs.git diff --git a/lib/libshare/smb.c b/lib/libshare/smb.c index e34d142..a545bfb 100644 --- a/lib/libshare/smb.c +++ b/lib/libshare/smb.c @@ -423,7 +423,15 @@ static const sa_share_ops_t smb_shareops = { static boolean_t smb_available(void) { - /* TODO: Sanity check NET_CMD_PATH and SHARE_DIR */ + struct stat statbuf; + + if (lstat(SHARE_DIR, &statbuf) != 0 || + !S_ISDIR(statbuf.st_mode)) + return B_FALSE; + + if (access(NET_CMD_PATH, F_OK) != 0) + return B_FALSE; + return B_TRUE; }