aboutsummaryrefslogtreecommitdiffstats
path: root/util/fusermount.c
diff options
context:
space:
mode:
Diffstat (limited to 'util/fusermount.c')
-rw-r--r--util/fusermount.c9
1 files changed, 7 insertions, 2 deletions
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)