diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2016-11-22 16:34:21 -0800 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2016-11-22 16:34:21 -0800 |
commit | 4175f969bdacf76113f74cc0e8d419aec845317f (patch) | |
tree | f8bdaff89b13610d2190fe2e4005824410b37011 /lib/mount.c | |
parent | 05de3c98c07e636e007e7ecf6516508426d02c83 (diff) | |
download | libfuse-4175f969bdacf76113f74cc0e8d419aec845317f.tar.gz |
Make handling of -oallow_root easier to understand
-oallow_root is handled in userspace, and requires passing -oallow_other
to the kernel. This patch should make the code easier to understand and
avoid the confusion that gave rise to issue #86.
Diffstat (limited to 'lib/mount.c')
-rw-r--r-- | lib/mount.c | 17 |
1 files changed, 2 insertions, 15 deletions
diff --git a/lib/mount.c b/lib/mount.c index 5bd2858..8fbebbf 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -57,13 +57,12 @@ enum { KEY_FUSERMOUNT_OPT, KEY_SUBTYPE_OPT, KEY_MTAB_OPT, - KEY_ALLOW_ROOT, + KEY_ALLOW_OTHER, KEY_RO, }; struct mount_opts { int allow_other; - int allow_root; int flags; int auto_unmount; int blkdev; @@ -80,14 +79,12 @@ struct mount_opts { static const struct fuse_opt fuse_mount_opts[] = { FUSE_MOUNT_OPT("allow_other", allow_other), - FUSE_MOUNT_OPT("allow_root", allow_root), FUSE_MOUNT_OPT("blkdev", blkdev), FUSE_MOUNT_OPT("auto_unmount", auto_unmount), FUSE_MOUNT_OPT("fsname=%s", fsname), FUSE_MOUNT_OPT("max_read=%u", max_read), FUSE_MOUNT_OPT("subtype=%s", subtype), FUSE_OPT_KEY("allow_other", KEY_KERN_OPT), - FUSE_OPT_KEY("allow_root", KEY_ALLOW_ROOT), FUSE_OPT_KEY("auto_unmount", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("blkdev", KEY_FUSERMOUNT_OPT), FUSE_OPT_KEY("fsname=", KEY_FUSERMOUNT_OPT), @@ -185,15 +182,10 @@ static void set_mount_flag(const char *s, int *flags) static int fuse_mount_opt_proc(void *data, const char *arg, int key, struct fuse_args *outargs) { + (void) outargs; struct mount_opts *mo = data; switch (key) { - case KEY_ALLOW_ROOT: - if (fuse_opt_add_opt(&mo->kernel_opts, "allow_other") == -1 || - fuse_opt_add_arg(outargs, "-oallow_root") == -1) - return -1; - return 0; - case KEY_RO: arg = "ro"; /* fall through */ @@ -548,11 +540,6 @@ struct mount_opts *parse_mount_opts(struct fuse_args *args) fuse_opt_parse(args, mo, fuse_mount_opts, fuse_mount_opt_proc) == -1) goto err_out; - if (mo->allow_other && mo->allow_root) { - fprintf(stderr, "fuse: 'allow_other' and 'allow_root' options are mutually exclusive\n"); - goto err_out; - } - return mo; err_out: |