On Sun, May 18, 2014 at 20:16, Helg wrote:
> 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. 
> 

Thanks, though your patch mixes up some of the null checking. We can
instead simply use realpath to copy the string for us.

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 17:38:00 -0000
@@ -153,7 +153,7 @@ fuse_mount(const char *dir, unused struc
        if (fc == NULL)
                return (NULL);
 
-       fc->dir = strdup(dir);
+       fc->dir = realpath(dir, NULL);
        if (fc->dir == NULL)
                goto bad;
 
@@ -163,7 +163,7 @@ fuse_mount(const char *dir, unused struc
        }
 
        fargs.fd = fc->fd;
-       if (mount(MOUNT_FUSEFS, dir, 0, &fargs)) {
+       if (mount(MOUNT_FUSEFS, fc->dir, 0, &fargs)) {
                switch (errno) {
                case EMFILE:
                        errcause = "mount table full";

Reply via email to