Matt McCutchen's Web Site
/
rsync
/
rsync.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Document the "copy-some-dirlinks" trick in the man page.
[rsync/rsync.git]
/
flist.c
diff --git
a/flist.c
b/flist.c
index
6d450bf
..
ad6b5bf
100644
(file)
--- a/
flist.c
+++ b/
flist.c
@@
-1564,12
+1564,6
@@
static void send_if_directory(int f, struct file_list *flist,
unsigned int len = strlen(fbuf);
if (len > 1 && fbuf[len-1] == '/')
fbuf[--len] = '\0';
unsigned int len = strlen(fbuf);
if (len > 1 && fbuf[len-1] == '/')
fbuf[--len] = '\0';
- if (len >= MAXPATHLEN - 1) {
- io_error |= IOERR_GENERAL;
- rprintf(FERROR_XFER, "skipping long-named directory: %s\n",
- full_fname(fbuf));
- return;
- }
save_filters = push_local_filters(fbuf, len);
send_directory(f, flist, fbuf, len, flags);
pop_local_filters(save_filters);
save_filters = push_local_filters(fbuf, len);
send_directory(f, flist, fbuf, len, flags);
pop_local_filters(save_filters);
@@
-1728,21
+1722,29
@@
static void send_directory(int f, struct file_list *flist, char *fbuf, int len,
}
p = fbuf + len;
}
p = fbuf + len;
- if (len != 1 || *fbuf != '/')
+ if (len == 1 && *fbuf == '/')
+ remainder = MAXPATHLEN - 1;
+ else if (len < MAXPATHLEN-1) {
*p++ = '/';
*p++ = '/';
- *p = '\0';
- remainder = MAXPATHLEN - (p - fbuf);
+ *p = '\0';
+ remainder = MAXPATHLEN - (len + 1);
+ } else
+ remainder = 0;
for (errno = 0, di = readdir(d); di; errno = 0, di = readdir(d)) {
char *dname = d_name(di);
if (dname[0] == '.' && (dname[1] == '\0'
|| (dname[1] == '.' && dname[2] == '\0')))
continue;
for (errno = 0, di = readdir(d); di; errno = 0, di = readdir(d)) {
char *dname = d_name(di);
if (dname[0] == '.' && (dname[1] == '\0'
|| (dname[1] == '.' && dname[2] == '\0')))
continue;
- if (strlcpy(p, dname, remainder) >= remainder) {
+ unsigned name_len = strlcpy(p, dname, remainder);
+ if (name_len >= remainder) {
+ char save = fbuf[len];
+ fbuf[len] = '\0';
io_error |= IOERR_GENERAL;
rprintf(FERROR_XFER,
io_error |= IOERR_GENERAL;
rprintf(FERROR_XFER,
- "cannot send long-named file %s\n",
- full_fname(fbuf));
+ "filename overflows max-path len by %u: %s/%s\n",
+ name_len - remainder + 1, fbuf, dname);
+ fbuf[len] = save;
continue;
}
if (dname[0] == '\0') {
continue;
}
if (dname[0] == '\0') {