Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e4ed195
)
Change clean_fname() to keep "//" at the start for cygwin.
author
Wayne Davison
<wayned@samba.org>
Sat, 15 Nov 2008 22:17:49 +0000
(14:17 -0800)
committer
Wayne Davison
<wayned@samba.org>
Sat, 15 Nov 2008 22:18:36 +0000
(14:18 -0800)
util.c
patch
|
blob
|
blame
|
history
diff --git
a/util.c
b/util.c
index
373ce33
..
376fb79
100644
(file)
--- a/
util.c
+++ b/
util.c
@@
-806,7
+806,8
@@
int count_dir_elements(const char *p)
return cnt;
}
return cnt;
}
-/* Turns multiple adjacent slashes into a single slash, drops all leading or
+/* Turns multiple adjacent slashes into a single slash (possible exception:
+ * the preserving of two leading slashes at the start), drops all leading or
* interior "." elements unless CFN_KEEP_DOT_DIRS is flagged. Will also drop
* a trailing '.' after a '/' if CFN_DROP_TRAILING_DOT_DIR is flagged, removes
* a trailing slash (perhaps after removing the aforementioned dot) unless
* interior "." elements unless CFN_KEEP_DOT_DIRS is flagged. Will also drop
* a trailing '.' after a '/' if CFN_DROP_TRAILING_DOT_DIR is flagged, removes
* a trailing slash (perhaps after removing the aforementioned dot) unless
@@
-821,9
+822,16
@@
unsigned int clean_fname(char *name, int flags)
if (!name)
return 0;
if (!name)
return 0;
- if ((anchored = *f == '/') != 0)
+ if ((anchored = *f == '/') != 0)
{
*t++ = *f++;
*t++ = *f++;
- else if (flags & CFN_KEEP_DOT_DIRS && *f == '.' && f[1] == '/') {
+#ifdef __CYGWIN__
+ /* If there are exactly 2 slashes at the start, preserve
+ * them. Would break daemon excludes unless the paths are
+ * really treated differently, so used this sparingly. */
+ if (*f == '/' && f[1] != '/')
+ *t++ = *f++;
+#endif
+ } else if (flags & CFN_KEEP_DOT_DIRS && *f == '.' && f[1] == '/') {
*t++ = *f++;
*t++ = *f++;
}
*t++ = *f++;
*t++ = *f++;
}