return 1;
}
-static void send_file_entry(struct file_struct *file, int f, int ndx)
+static void send_file_entry(int f, struct file_struct *file, int ndx)
{
static time_t modtime;
static mode_t mode;
free(REQ_EXTRA(file, extra_cnt));
}
-static struct file_struct *send_file_name(struct file_list *flist,
+static struct file_struct *send_file_name(int f, struct file_list *flist,
char *fname, STRUCT_STAT *stp,
int flags, int filter_flags)
{
flist_expand(flist);
flist->files[flist->count++] = file;
+ if (f >= 0)
+ send_file_entry(f, file, flist->count - 1);
return file;
}
int divert_dirs = (flags & FLAG_DIVERT_DIRS) != 0;
int start = divert_dirs ? dir_flist->count : flist->count;
int filter_flags = f == -2 ? SERVER_FILTERS : ALL_FILTERS;
- struct file_struct *file;
assert(flist != NULL);
continue;
}
- file = send_file_name(flist, fbuf, NULL, flags, filter_flags);
- if (file && f >= 0)
- send_file_entry(file, f, flist->count - 1);
+ send_file_name(f, flist, fbuf, NULL, flags, filter_flags);
}
fbuf[len] = '\0';
char lastpath[MAXPATHLEN] = "";
struct file_list *flist;
struct timeval start_tv, end_tv;
- struct file_struct *file;
int64 start_write;
int use_ff_fd = 0;
int flags, disable_buffering;
xfer_dirs = 1;
while ((slash = strchr(slash+1, '/')) != 0) {
*slash = '\0';
- file = send_file_name(flist, fbuf, NULL, dir_flags, ALL_FILTERS);
- if (file)
- send_file_entry(file, f, flist->count - 1);
+ send_file_name(f, flist, fbuf, NULL,
+ dir_flags, ALL_FILTERS);
*slash = '/';
}
copy_links = save_copy_links;
filesystem_dev = st.st_dev;
if (recurse || (xfer_dirs && is_dot_dir)) {
+ struct file_struct *file;
int top_flags = FLAG_TOP_DIR | FLAG_XFER_DIR
| (is_dot_dir ? 0 : flags)
| (incremental ? FLAG_DIVERT_DIRS : 0);
- file = send_file_name(flist, fbuf, &st, top_flags, ALL_FILTERS);
- if (file) {
- send_file_entry(file, f, flist->count - 1);
- if (!incremental)
- send_if_directory(f, flist, file, fbuf, len, flags);
- }
- } else {
- file = send_file_name(flist, fbuf, &st, flags, ALL_FILTERS);
- if (file)
- send_file_entry(file, f, flist->count - 1);
- }
+ file = send_file_name(f, flist, fbuf, &st,
+ top_flags, ALL_FILTERS);
+ if (file && !incremental)
+ send_if_directory(f, flist, file, fbuf, len, flags);
+ } else
+ send_file_name(f, flist, fbuf, &st, flags, ALL_FILTERS);
}
gettimeofday(&end_tv, NULL);