aboutsummaryrefslogtreecommitdiffstats
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
parentd4a531b92d74171eccbebb9892a18cab63d370d7 (diff)
downloadbindfs-93199f24f59d3125beadce0b3ebff0eacb106e2c.tar.gz
Don't call realpath() on source dirs starting with "/proc/".
Fixes #66.
-rw-r--r--ChangeLog4
-rw-r--r--src/bindfs.c15
2 files changed, 14 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 1b1b8b3..72e9b5c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2018-10-09 Martin Pärtel <martin dot partel at gmail dot com>
+
+ * Don't call realpath() on source dirs starting with "/proc/". See #66.
+
2017-11-30 Martin Pärtel <martin dot partel at gmail dot com>
* Added options --delete-deny and --rename-deny as suggested by @roojs.
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
};