summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2008-03-20 10:35:53 -0700
committerWayne Davison <wayned@samba.org>2008-03-20 10:35:53 -0700
commitd2f6e192623989eac4015582e1e20f61499cc782 (patch)
tree7037935cdc998948c39d787ff9ff759b02ff192d
parente889e0c43bc6b55ff2c20091a66bb1676de5369f (diff)
downloadrsync-d2f6e192623989eac4015582e1e20f61499cc782.tar.gz
Fixed a bug in the truncating of daemon-excluded paths.
-rw-r--r--util.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/util.c b/util.c
index b5c15fba..434c74c5 100644
--- a/util.c
+++ b/util.c
@@ -569,7 +569,7 @@ void glob_expand(char *s, char ***argv_ptr, int *argc_ptr, int *maxargs_ptr)
}
for (cp = s; *cp; cp++) {
if (*cp == '/') {
- if (--slashes <= 0) {
+ if (slashes-- <= 0) {
*cp = '\0';
break;
}
@@ -829,16 +829,14 @@ char *sanitize_path(char *dest, const char *p, const char *rootdir, int depth)
}
start = sanp = dest + rlen;
+ /* This loop iterates once per filename component in p, pointing at
+ * the start of the name (past any prior slash) for each iteration. */
while (*p) {
/* discard leading or extra slashes */
if (*p == '/') {
p++;
continue;
}
- /* this loop iterates once per filename component in p.
- * both p (and sanp if the original had a slash) should
- * always be left pointing after a slash
- */
if (*p == '.' && (p[1] == '/' || p[1] == '\0')) {
if (leave_one_dotdir && p[1])
leave_one_dotdir = 0;