diff --git a/lib/libzfs/libzfs_mount.c b/lib/libzfs/libzfs_mount.c index b0279d8fbc3f..e97de8f20262 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);