mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
libzfs: report permission error from umount helper
Non-root callers got "unmount failed" when ZFS_MOUNT_HELPER was set because /bin/umount's exit status doesn't preserve errno. Map a non-zero helper exit to EPERM when geteuid() != 0 so the user sees "permission denied". Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Christos Longros <[email protected]> Closes #11740 Closes #18443
This commit is contained in:
1 parent
9be5431c5d
commit
7fdd2bf7d4
1 file changed
+5
-1
@@ -406,7 +406,11 @@ do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags)
|
||||
argv[count] = (char *)mntpt;
|
||||
rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
|
||||
|
||||
return (rc ? EINVAL : 0);
|
||||
if (rc == 0)
|
||||
return (0);
|
||||
if (rc > 0 && geteuid() != 0)
|
||||
return (EPERM);
|
||||
return (EINVAL);
|
||||
}
|
||||
|
||||
#ifdef HAVE_MOUNT_SETATTR
|
||||
|
||||
Reference in new issue
Block a user