This patch forces fuse to mount a client filesystem using the realpath
when a relative path is specified for the mount point. Without this, to
unmount a filesystem you need to change directory to the same folder
you where in when you mounted it. 

-- 
Helg <xx...@msn.com>


Index: fuse.c
===================================================================
RCS file: /cvs/src/lib/libfuse/fuse.c,v
retrieving revision 1.21
diff -u -p -r1.21 fuse.c
--- fuse.c      24 Mar 2014 07:24:32 -0000      1.21
+++ fuse.c      18 May 2014 12:08:27 -0000
@@ -148,22 +148,27 @@ fuse_mount(const char *dir, unused struc
        struct fusefs_args fargs;
        struct fuse_chan *fc;
        const char *errcause;
+       char real_dir[PATH_MAX];
 
        fc = calloc(1, sizeof(*fc));
        if (fc == NULL)
                return (NULL);
 
-       fc->dir = strdup(dir);
-       if (fc->dir == NULL)
+       if (dir == NULL)
                goto bad;
 
+       if (realpath(dir, real_dir) == NULL)
+               goto bad;
+
+       fc->dir = strdup(real_dir);
+
        if ((fc->fd = open("/dev/fuse0", O_RDWR)) == -1) {
                perror(__func__);
                goto bad;
        }
 
        fargs.fd = fc->fd;
-       if (mount(MOUNT_FUSEFS, dir, 0, &fargs)) {
+       if (mount(MOUNT_FUSEFS, real_dir, 0, &fargs)) {
                switch (errno) {
                case EMFILE:
                        errcause = "mount table full";

Reply via email to