freebsd/libshare: nfs: make nfs_is_shared() thread-safe

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: George Wilson <gwilson@delphix.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11886
This commit is contained in:
наб 2021-04-11 20:12:50 +02:00 committed by Brian Behlendorf
parent 8357bbff1f
commit 62866fc96c

View File

@ -259,14 +259,10 @@ nfs_disable_share(sa_share_impl_t impl_share)
ZFS_EXPORTS_LOCK, ZFS_EXPORTS_FILE, NULL, impl_share)); ZFS_EXPORTS_LOCK, ZFS_EXPORTS_FILE, NULL, impl_share));
} }
/*
* NOTE: This function returns a static buffer and thus is not thread-safe.
*/
static boolean_t static boolean_t
nfs_is_shared(sa_share_impl_t impl_share) nfs_is_shared(sa_share_impl_t impl_share)
{ {
static char line[MAXLINESIZE]; char *s, last, line[MAXLINESIZE];
char *s, last;
size_t len; size_t len;
char *mntpoint = impl_share->sa_mountpoint; char *mntpoint = impl_share->sa_mountpoint;
size_t mntlen = strlen(mntpoint); size_t mntlen = strlen(mntpoint);