static struct file_struct *send_file_name(int f, struct file_list *flist,
char *fname, STRUCT_STAT *stp,
- int flags, int filter_flags)
+ int flags, int filter_level)
{
struct file_struct *file;
#if defined SUPPORT_ACLS || defined SUPPORT_XATTRS
statx sx;
#endif
- file = make_file(fname, flist, stp, flags, filter_flags);
+ file = make_file(fname, flist, stp, flags, filter_level);
if (!file)
return NULL;
DIR *d;
int divert_dirs = (flags & FLAG_DIVERT_DIRS) != 0;
int start = flist->used;
- int filter_flags = f == -2 ? SERVER_FILTERS : ALL_FILTERS;
+ int filter_level = f == -2 ? SERVER_FILTERS : ALL_FILTERS;
assert(flist != NULL);
continue;
}
- send_file_name(f, flist, fbuf, NULL, flags, filter_flags);
+ send_file_name(f, flist, fbuf, NULL, flags, filter_level);
}
fbuf[len] = '\0';
* files in the upcoming file-lists. */
if (cur_flist->next) {
flist = first_flist->prev; /* the newest flist */
- future_cnt = flist->used + flist->ndx_start
- - cur_flist->next->ndx_start;
+ future_cnt = flist->ndx_end - cur_flist->next->ndx_start + 1;
} else
future_cnt = 0;
while (future_cnt < at_least) {
#endif
dir_ndx = send_dir_ndx;
write_ndx(f, NDX_FLIST_OFFSET - dir_ndx);
+ flist->parent_ndx = dir_ndx;
send1extra(f, file, flist);
dp = F_DIRNODE_P(file);
clean_flist(flist, 0);
+ flist->ndx_end = flist->ndx_start + flist->used - 1
+ - (dir_count - dstart);
+
add_dirs_to_tree(send_dir_ndx, flist, dir_count - dstart);
flist_done_allocating(flist);
}
file_total += flist->used;
+ /* We don't subtract dir_count for the first send since we
+ * might have one or more dot dirs which need to get sent. */
+ flist->ndx_end = flist->ndx_start + flist->used - 1;
+
if (!numeric_ids && !inc_recurse)
send_id_list(f);
}
file_total += flist->used;
+ flist->ndx_end = flist->ndx_start + flist->used - 1;
+ if (inc_recurse && flist->ndx_start)
+ flist->ndx_end -= dir_flist->used - dstart;
+
if (verbose > 2)
rprintf(FINFO, "received %d names\n", flist->used);
} else {
flist->file_pool = first_flist->file_pool;
- flist->ndx_start = first_flist->prev->ndx_start
- + first_flist->prev->used;
+ flist->ndx_start = first_flist->prev->ndx_end + 2;
flist->prev = first_flist->prev;
flist->prev->next = first_flist->prev = flist;
const char *who = who_am_i();
int i;
- rprintf(FINFO, "[%s] flist start=%d, count=%d, low=%d, high=%d\n",
- who, flist->ndx_start, flist->used, flist->low, flist->high);
+ rprintf(FINFO, "[%s] flist start=%d, end=%d, used=%d, low=%d, high=%d\n",
+ who, flist->ndx_start, flist->ndx_end, flist->used, flist->low, flist->high);
for (i = 0; i < flist->used; i++) {
file = flist->sorted[i];
if ((am_root || am_sender) && uid_ndx) {