From 16d7c0a74e4764576c1b282ecdb8c24252cde500 Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 10 Dec 2004 11:55:04 +0000 Subject: fix --- ChangeLog | 5 +++++ util/fusermount.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 27aff18..7ecd861 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 44cca17..1b15d3e 100644 --- a/util/fusermount.c +++ b/util/fusermount.c @@ -780,8 +780,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) -- cgit v1.2.1