diff options
author | Matthew <matthew@matthew-cash.com> | 2024-02-23 22:56:49 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-24 07:56:49 +0100 |
commit | 74b1df2e84e836a1710561f52075d51f20cd5c78 (patch) | |
tree | f1cdbbe566e18dc5d0ac86b237bf935c8de2acaa /lib | |
parent | 402c8fff588120a7cf5922822904ce45f30612a8 (diff) | |
download | libfuse-74b1df2e84e836a1710561f52075d51f20cd5c78.tar.gz |
Passthrough options starting with "x-" to mtab (#894)
This implements #651, tested with bindfs.
"x-*" options are comments meant to be interpreted by userspace.
#651 is about some 3rd party mount options like 'x-gvfs-notrash'.
This also removes the test if /etc/mtab is a symlink.
This test was added in commit 5f28cd15ab43c741f6d116be4d3a9aa5d82ab385
and the corresponding ChangeLog entry in this commit points to mount
issues for read-only mtab.
However, in all recent Linux distributions /etc/mtab is a symlink to
/proc/self/mounts and never writable. In fact, util-linux 2.39
(libmount) entirely removed support for a writable mtab.
At least since util-linux 2.19 (10-Feb-2011) /run/mount/utab is used
as replacement for userspace mount entries..
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mount.c | 6 | ||||
-rw-r--r-- | lib/mount_util.c | 4 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/mount.c b/lib/mount.c index d71e6fc..f98a8bb 100644 --- a/lib/mount.c +++ b/lib/mount.c @@ -209,6 +209,12 @@ static int fuse_mount_opt_proc(void *data, const char *arg, int key, case KEY_MTAB_OPT: return fuse_opt_add_opt(&mo->mtab_opts, arg); + + /* Third party options like 'x-gvfs-notrash' */ + case FUSE_OPT_KEY_OPT: + return (strncmp("x-", arg, 2) == 0) ? + fuse_opt_add_opt(&mo->mtab_opts, arg) : + 1; } /* Pass through unknown options */ diff --git a/lib/mount_util.c b/lib/mount_util.c index 8027a2e..dd32276 100644 --- a/lib/mount_util.c +++ b/lib/mount_util.c @@ -54,7 +54,6 @@ static int mtab_needs_update(const char *mnt) * Skip mtab update if /etc/mtab: * * - doesn't exist, - * - is a symlink, * - is on a read-only filesystem. */ res = lstat(_PATH_MOUNTED, &stbuf); @@ -65,9 +64,6 @@ static int mtab_needs_update(const char *mnt) uid_t ruid; int err; - if (S_ISLNK(stbuf.st_mode)) - return 0; - ruid = getuid(); if (ruid != 0) setreuid(0, -1); |