summaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorMatthias Görgens <matthias.goergens@gmail.com>2023-04-12 15:39:32 +0800
committerGitHub <noreply@github.com>2023-04-12 08:39:32 +0100
commit7297044ada625da583211f0a574410cddb4f7d8d (patch)
treefa4a6fa67325614526f06fb9eae6c1d039eb64a6 /example
parent681a0c1178fa93017a363a901d0348710582e90b (diff)
downloadfuse-7297044ada625da583211f0a574410cddb4f7d8d.tar.gz
Fuse mount: make auto_unmount compatible with suid/dev mount options (#762)
* Fuse mount: make auto_unmount compatible with suid/dev mount options > When you run as root, fuse normally does not call fusermount but uses > the mount system call directly. When you specify auto_unmount, it goes > through fusermount instead. However, fusermount is a setuid binary that > is normally called by regular users, so it cannot in general accept suid > or dev options. In this patch, we split up how fuse mounts as root when `auto_unmount` is specified. First, we mount using system calls directly, then we reach out to fusermount to set up auto_unmount only (with no actual mounting done in fusermount). Fixes: #148
Diffstat (limited to 'example')
-rw-r--r--example/passthrough_ll.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/example/passthrough_ll.c b/example/passthrough_ll.c
index 8b2eb4b..070cef1 100644
--- a/example/passthrough_ll.c
+++ b/example/passthrough_ll.c
@@ -89,7 +89,7 @@ struct lo_data {
int writeback;
int flock;
int xattr;
- const char *source;
+ char *source;
double timeout;
int cache;
int timeout_set;
@@ -1240,7 +1240,11 @@ int main(int argc, char *argv[])
}
} else {
- lo.source = "/";
+ lo.source = strdup("/");
+ if(!lo.source) {
+ fuse_log(FUSE_LOG_ERR, "fuse: memory allocation failed\n");
+ exit(1);
+ }
}
if (!lo.timeout_set) {
switch (lo.cache) {
@@ -1302,5 +1306,6 @@ err_out1:
if (lo.root.fd >= 0)
close(lo.root.fd);
+ free(lo.source);
return ret ? 1 : 0;
}