X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/blobdiff_plain/bc6ebcd24804445590b8e20fd547fe25f3d140f5..4e1f385711a5c5703eb1c3bbf21cc83c95fe3a6e:/util.c diff --git a/util.c b/util.c index 22127231..a01a38d1 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; @@ -1039,7 +1042,6 @@ int msleep(int t) struct timeval tval, t1, t2; gettimeofday(&t1, NULL); - gettimeofday(&t2, NULL); while (tdiff < t) { tval.tv_sec = (t-tdiff)/1000;