X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/bc6ebcd24804445590b8e20fd547fe25f3d140f5..9a5ade185cc2ac20f16c95b6d28fea85b0d358de:/util.c diff --git a/util.c b/util.c index 22127231..69433359 100644 --- a/util.c +++ b/util.c @@ -707,9 +707,12 @@ void sanitize_path(char *p, char *reldir) int allowdotdot = 0; if (reldir) { - depth++; + int new_component = 1; while (*reldir) { - if (*reldir++ == '/') { + if (*reldir++ == '/') + new_component = 1; + else if (new_component) { + new_component = 0; depth++; } } @@ -885,7 +888,7 @@ int pop_dir(char *dir) * The string " (in MODNAME)" may also be appended. The returned pointer * remains valid until the next time full_fname() is called. **/ -char *full_fname(char *fn) +char *full_fname(const char *fn) { static char *result = NULL; char *m1, *m2, *m3;