aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
authorнаб <[email protected]>2022-03-18 18:40:13 +0100
committerBrian Behlendorf <[email protected]>2022-05-12 09:27:04 -0700
commit1ec9218faa2f0d11b66ec1eb9d202692b1eec2cd (patch)
tree5bec527c10fd15c7b10cac9d321b716bb677b196 /lib/libzfs
parent88d5580e511540b996dfb802a7ee4912980fe1e7 (diff)
libzfs: zfs_unshare: minor cleanup
Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Closes #13165
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_mount.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index d007441f8..a2f1c982c 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -797,20 +797,15 @@ zfs_unshare(zfs_handle_t *zhp, const char *mountpoint,
{
libzfs_handle_t *hdl = zhp->zfs_hdl;
struct mnttab entry;
- const char *mntpt = NULL;
if (proto == NULL)
proto = share_all_proto;
- /* check to see if need to unmount the filesystem */
- if (mountpoint != NULL)
- mntpt = mountpoint;
-
if (mountpoint != NULL || ((zfs_get_type(zhp) == ZFS_TYPE_FILESYSTEM) &&
libzfs_mnttab_find(hdl, zfs_get_name(zhp), &entry) == 0)) {
- if (mountpoint == NULL)
- mntpt = entry.mnt_mountp;
+ /* check to see if need to unmount the filesystem */
+ const char *mntpt = mountpoint ?: entry.mnt_mountp;
for (const enum sa_protocol *curr_proto = proto;
*curr_proto != SA_NO_PROTOCOL; curr_proto++)