| 2225 | } |
| 2226 | |
| 2227 | struct file_list *send_file_list(int f, int argc, char *argv[]) |
| 2228 | { |
| 2229 | static const char *lastdir; |
| 2230 | static int lastdir_len = -1; |
| 2231 | int len, dirlen; |
| 2232 | STRUCT_STAT st = {0}; |
| 2233 | char *p, *dir; |
| 2234 | struct file_list *flist; |
| 2235 | struct timeval start_tv, end_tv; |
| 2236 | int64 start_write; |
| 2237 | int use_ff_fd = 0; |
| 2238 | int disable_buffering, reenable_multiplex = -1; |
| 2239 | int flags = recurse ? FLAG_CONTENT_DIR : 0; |
| 2240 | int reading_remotely = filesfrom_host != NULL; |
| 2241 | int rl_flags = (reading_remotely ? 0 : RL_DUMP_COMMENTS) |
| 2242 | #ifdef ICONV_OPTION |
| 2243 | | (filesfrom_convert ? RL_CONVERT : 0) |
| 2244 | #endif |
| 2245 | | (eol_nulls || reading_remotely ? RL_EOL_NULLS : 0); |
| 2246 | int implied_dot_dir = 0; |
| 2247 | |
| 2248 | rprintf(FLOG, "building file list\n"); |
| 2249 | if (show_filelist_progress) |
| 2250 | start_filelist_progress("building file list"); |
| 2251 | else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server) |
| 2252 | rprintf(FCLIENT, "sending incremental file list\n"); |
| 2253 | |
| 2254 | start_write = stats.total_written; |
| 2255 | gettimeofday(&start_tv, NULL); |
| 2256 | |
| 2257 | if (relative_paths && protocol_version >= 30) |
| 2258 | implied_dirs = 1; /* We send flagged implied dirs */ |
| 2259 | |
| 2260 | #ifdef SUPPORT_HARD_LINKS |
| 2261 | if (preserve_hard_links && protocol_version >= 30 && !cur_flist) |
| 2262 | init_hard_links(); |
| 2263 | #endif |
| 2264 | |
| 2265 | flist = cur_flist = flist_new(0, "send_file_list"); |
| 2266 | flist_expand(flist, FLIST_START_LARGE); |
| 2267 | if (inc_recurse) { |
| 2268 | dir_flist = flist_new(FLIST_TEMP, "send_file_list"); |
| 2269 | flist_expand(dir_flist, FLIST_START_LARGE); |
| 2270 | flags |= FLAG_DIVERT_DIRS; |
| 2271 | } else |
| 2272 | dir_flist = cur_flist; |
| 2273 | |
| 2274 | disable_buffering = io_start_buffering_out(f); |
| 2275 | if (filesfrom_fd >= 0) { |
| 2276 | if (argv[0] && !change_dir(argv[0], CD_NORMAL)) { |
| 2277 | rsyserr(FERROR_XFER, errno, "change_dir %s failed", |
| 2278 | full_fname(argv[0])); |
| 2279 | exit_cleanup(RERR_FILESELECT); |
| 2280 | } |
| 2281 | if (protocol_version < 31) { |
| 2282 | /* Older protocols send the files-from data w/o packaging |
| 2283 | * it in multiplexed I/O packets, so temporarily switch |
| 2284 | * to buffered I/O to match this behavior. */ |
no test coverage detected