Skip to content

Commit 7fdd2bf

Browse files
authored
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 <behlendorf1@llnl.gov> Signed-off-by: Christos Longros <chris.longros@gmail.com> Closes #11740 Closes #18443
1 parent 9be5431 commit 7fdd2bf

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lib/libzfs/os/linux/libzfs_mount_os.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,7 +406,11 @@ do_unmount(zfs_handle_t *zhp, const char *mntpt, int flags)
406406
argv[count] = (char *)mntpt;
407407
rc = libzfs_run_process(argv[0], argv, STDOUT_VERBOSE|STDERR_VERBOSE);
408408

409-
return (rc ? EINVAL : 0);
409+
if (rc == 0)
410+
return (0);
411+
if (rc > 0 && geteuid() != 0)
412+
return (EPERM);
413+
return (EINVAL);
410414
}
411415

412416
#ifdef HAVE_MOUNT_SETATTR

0 commit comments

Comments
 (0)