aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_mount.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c
index b0279d8fb..e97de8f20 100644
--- a/lib/libzfs/libzfs_mount.c
+++ b/lib/libzfs/libzfs_mount.c
@@ -595,9 +595,13 @@ unmount_one(zfs_handle_t *zhp, const char *mountpoint, int flags)
default:
libzfs_err = EZFS_UMOUNTFAILED;
}
- return (zfs_error_fmt(zhp->zfs_hdl, libzfs_err,
- dgettext(TEXT_DOMAIN, "cannot unmount '%s'"),
- mountpoint));
+ if (zhp) {
+ return (zfs_error_fmt(zhp->zfs_hdl, libzfs_err,
+ dgettext(TEXT_DOMAIN, "cannot unmount '%s'"),
+ mountpoint));
+ } else {
+ return (-1);
+ }
}
return (0);