aboutsummaryrefslogtreecommitdiffstats
path: root/src/bindfs.c
diff options
context:
space:
mode:
authorMartin Pärtel <martin.partel@gmail.com>2018-10-09 22:45:38 +0300
committerMartin Pärtel <martin.partel@gmail.com>2018-10-09 22:45:38 +0300
commit93199f24f59d3125beadce0b3ebff0eacb106e2c (patch)
tree1189e8aa4dcb264fcc75bc4553abfd6f2959e723 /src/bindfs.c
parentd4a531b92d74171eccbebb9892a18cab63d370d7 (diff)
downloadbindfs-93199f24f59d3125beadce0b3ebff0eacb106e2c.tar.gz
Don't call realpath() on source dirs starting with "/proc/".
Fixes #66.
Diffstat (limited to 'src/bindfs.c')
-rw-r--r--src/bindfs.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/src/bindfs.c b/src/bindfs.c
index 6cd7c60..baacb82 100644
--- a/src/bindfs.c
+++ b/src/bindfs.c
@@ -1636,7 +1636,15 @@ static int process_option(void *data, const char *arg, int key,
case OPTKEY_NONOPTION:
if (!settings.mntsrc) {
- settings.mntsrc = realpath(arg, NULL);
+ if (strncmp(arg, "/proc/", strlen("/proc/")) == 0) {
+ // /proc/<PID>/root is a strange magical symlink that points to '/' when inspected,
+ // but leads to a container's root directory when traversed.
+ // This only works if we don't call realpath() on it.
+ // See also: #66
+ settings.mntsrc = strdup(arg);
+ } else {
+ settings.mntsrc = realpath(arg, NULL);
+ }
if (settings.mntsrc == NULL) {
fprintf(stderr, "Failed to resolve source directory `%s': ", arg);
perror(NULL);
@@ -1977,10 +1985,7 @@ int main(int argc, char *argv[])
OPT_OFFSET2("--multithreaded", "multithreaded", multithreaded, -1),
OPT_OFFSET2("--uid-offset=%s", "uid-offset=%s", uid_offset, 0),
OPT_OFFSET2("--gid-offset=%s", "gid-offset=%s", gid_offset, 0),
-
-
-
-
+
FUSE_OPT_END
};