start, it refers to the file list's parent dir.
extern char *tmpdir;
extern char *partial_dir;
extern char *basis_dir[];
-extern struct file_list *cur_flist, *first_flist;
+extern struct file_list *cur_flist, *first_flist, *dir_flist;
extern struct filter_list_struct server_filter_list;
static struct bitbag *delayed_bits = NULL;
continue;
}
- file = cur_flist->files[ndx - cur_flist->ndx_start];
+ if (ndx - cur_flist->ndx_start >= 0)
+ file = cur_flist->files[ndx - cur_flist->ndx_start];
+ else
+ file = dir_flist->files[cur_flist->parent_ndx];
fname = local_name ? local_name : f_name(file, fbuf);
if (verbose > 2)
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;
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());
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;
}
extern int batch_fd;
extern int write_batch;
extern struct stats stats;
-extern struct file_list *cur_flist, *first_flist;
+extern struct file_list *cur_flist, *first_flist, *dir_flist;
/**
* @file
if (inc_recurse)
send_extra_file_list(f_out, FILECNT_LOOKAHEAD);
- file = cur_flist->files[ndx - cur_flist->ndx_start];
+ if (ndx - cur_flist->ndx_start >= 0)
+ file = cur_flist->files[ndx - cur_flist->ndx_start];
+ else
+ file = dir_flist->files[cur_flist->parent_ndx];
if (F_PATHNAME(file)) {
path = F_PATHNAME(file);
slash = "/";