summaryrefslogtreecommitdiff
path: root/rsync.c
diff options
context:
space:
mode:
authorWayne Davison <wayned@samba.org>2007-07-08 06:25:47 +0000
committerWayne Davison <wayned@samba.org>2007-07-08 06:25:47 +0000
commit6755a7d7426dcc9b887f80f066021dbacffc7b10 (patch)
tree6b4d97b85b3300a81f55c7daa32606b31b6b0a84 /rsync.c
parent5459e693a31e67bd68f6ef58d89ada67ddee9670 (diff)
downloadrsync-6755a7d7426dcc9b887f80f066021dbacffc7b10.tar.gz
If we get an ndx that is 1 entry prior to an incremental flist's
start, it refers to the file list's parent dir.
Diffstat (limited to 'rsync.c')
-rw-r--r--rsync.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/rsync.c b/rsync.c
index fbe18c7c..1ae33684 100644
--- a/rsync.c
+++ b/rsync.c
@@ -198,9 +198,8 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
invalid_ndx:
rprintf(FERROR,
"Invalid file index: %d (%d - %d) with iflags %x [%s]\n",
- ndx, first_flist->ndx_start + first_flist->ndx_start,
- first_flist->prev->ndx_start + first_flist->ndx_start
- + first_flist->prev->used - 1, iflags, who_am_i());
+ ndx, first_flist->ndx_start - 1, first_flist->prev->ndx_end,
+ iflags, who_am_i());
exit_cleanup(RERR_PROTOCOL);
}
cur_flist = flist;
@@ -220,7 +219,7 @@ int read_ndx_and_attrs(int f_in, int *iflag_ptr, uchar *type_ptr,
if (iflags & ITEM_TRANSFER) {
int i = ndx - cur_flist->ndx_start;
- if (!S_ISREG(cur_flist->files[i]->mode)) {
+ if (i < 0 || !S_ISREG(cur_flist->files[i]->mode)) {
rprintf(FERROR,
"received request to transfer non-regular file: %d [%s]\n",
ndx, who_am_i());
@@ -495,12 +494,12 @@ struct file_list *flist_for_ndx(int ndx)
if (!flist && !(flist = first_flist))
return NULL;
- while (ndx < flist->ndx_start) {
+ while (ndx < flist->ndx_start-1) {
if (flist == first_flist)
return NULL;
flist = flist->prev;
}
- while (ndx >= flist->ndx_start + flist->used) {
+ while (ndx > flist->ndx_end) {
if (!(flist = flist->next))
return NULL;
}