MCPcopy Create free account
hub / github.com/RsyncProject/rsync / recv_file_list

Function recv_file_list

flist.c:2596–2793  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2594}
2595
2596struct file_list *recv_file_list(int f, int dir_ndx)
2597{
2598 const char *good_dirname = NULL;
2599 struct file_list *flist;
2600 int dstart, flags;
2601 int64 start_read;
2602
2603 if (!first_flist) {
2604 if (show_filelist_progress)
2605 start_filelist_progress("receiving file list");
2606 else if (inc_recurse && INFO_GTE(FLIST, 1) && !am_server)
2607 rprintf(FCLIENT, "receiving incremental file list\n");
2608 rprintf(FLOG, "receiving file list\n");
2609 if (usermap)
2610 parse_name_map(usermap, True);
2611 if (groupmap)
2612 parse_name_map(groupmap, False);
2613 }
2614
2615 start_read = stats.total_read;
2616
2617#ifdef SUPPORT_HARD_LINKS
2618 if (preserve_hard_links && !first_flist)
2619 init_hard_links();
2620#endif
2621
2622 if (inc_recurse && dir_ndx >= 0) {
2623 if (dir_ndx >= dir_flist->used) {
2624 rprintf(FERROR_XFER, "rsync: refusing invalid dir_ndx %u >= %u\n", dir_ndx, dir_flist->used);
2625 exit_cleanup(RERR_PROTOCOL);
2626 }
2627 struct file_struct *file = dir_flist->files[dir_ndx];
2628 if (file->flags & FLAG_GOT_DIR_FLIST) {
2629 rprintf(FERROR_XFER, "rsync: refusing malicious duplicate flist for dir %d\n", dir_ndx);
2630 exit_cleanup(RERR_PROTOCOL);
2631 }
2632 file->flags |= FLAG_GOT_DIR_FLIST;
2633 }
2634
2635 flist = flist_new(0, "recv_file_list");
2636 flist_expand(flist, FLIST_START_LARGE);
2637
2638 if (inc_recurse) {
2639 if (flist->ndx_start == 1) {
2640 dir_flist = flist_new(FLIST_TEMP, "recv_file_list");
2641 flist_expand(dir_flist, FLIST_START_LARGE);
2642 }
2643 dstart = dir_flist->used;
2644 } else {
2645 dir_flist = flist;
2646 dstart = 0;
2647 }
2648
2649 while (1) {
2650 struct file_struct *file;
2651
2652 if (xfer_flags_as_varint) {
2653 if ((flags = read_varint(f)) == 0) {

Callers 5

wait_for_receiverFunction · 0.85
read_ndx_and_attrsFunction · 0.85
do_server_recvFunction · 0.85
client_runFunction · 0.85

Calls 15

start_filelist_progressFunction · 0.85
parse_name_mapFunction · 0.85
init_hard_linksFunction · 0.85
flist_newFunction · 0.85
flist_expandFunction · 0.85
read_varintFunction · 0.85
read_byteFunction · 0.85
recv_file_entryFunction · 0.85
f_nameFunction · 0.85
finish_filelist_progressFunction · 0.85
fsortFunction · 0.85

Tested by

no test coverage detected