From 0adcc6f7b2fdfdb14c560ad967ef0e61db3e2fde Mon Sep 17 00:00:00 2001 From: Miklos Szeredi Date: Fri, 10 Dec 2004 11:55:25 +0000 Subject: [PATCH] fix --- ChangeLog | 5 +++++ util/fusermount.c | 9 +++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) 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) -- 2.30.2