From: Miklos Szeredi Date: Fri, 10 Dec 2004 11:55:25 +0000 (+0000) Subject: fix X-Git-Tag: fuse_2_2_pre1~12 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=0adcc6f7b2fdfdb14c560ad967ef0e61db3e2fde;p=qemu-gpiodev%2Flibfuse.git fix --- diff --git a/ChangeLog b/ChangeLog index 23dbbc7..66e88c5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2004-12-10 Miklos Szeredi + + * When mounting on a subdirectory of / don't duplicate slashes at + the beggining of path (spotted by David Shaw) + 2004-12-09 Miklos Szeredi * Fix bug causing garbage in mount options (spotted by David Shaw) diff --git a/util/fusermount.c b/util/fusermount.c index 77e808e..40df490 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -817,8 +817,13 @@ static char *resolve_path(const char *orig) dst = strdup(buf); else { dst = (char *) malloc(strlen(buf) + 1 + strlen(lastcomp) + 1); - if (dst) - sprintf(dst, "%s/%s", buf, lastcomp); + if (dst) { + unsigned buflen = strlen(buf); + if (buflen && buf[buflen-1] == '/') + sprintf(dst, "%s%s", buf, lastcomp); + else + sprintf(dst, "%s/%s", buf, lastcomp); + } } free(copy); if (dst == NULL)