From 513d3fd806137134fcdc4b9fed656311b1bfd2e6 Mon Sep 17 00:00:00 2001 From: Wayne Davison Date: Fri, 11 Jan 2008 13:13:15 -0800 Subject: [PATCH] Improved check_for_finished_files() to be really, really sure that we've processed all the items on the hard-linked and redo queues before we return. --- generator.c | 102 +++++++++++++++++++++++++++------------------------- 1 file changed, 54 insertions(+), 48 deletions(-) diff --git a/generator.c b/generator.c index 35cbb572..c961ad2a 100644 --- a/generator.c +++ b/generator.c @@ -1897,57 +1897,63 @@ void check_for_finished_files(int itemizing, enum logcode code, int check_redo) char fbuf[MAXPATHLEN]; int ndx; + while (1) { #ifdef SUPPORT_HARD_LINKS - while (preserve_hard_links && (ndx = get_hlink_num()) != -1) { - flist = flist_for_ndx(ndx); - assert(flist != NULL); - file = flist->files[ndx - flist->ndx_start]; - assert(file->flags & FLAG_HLINKED); - finish_hard_link(file, f_name(file, fbuf), ndx, NULL, itemizing, code, -1); - flist->in_progress--; - } + if (preserve_hard_links && (ndx = get_hlink_num()) != -1) { + flist = flist_for_ndx(ndx); + assert(flist != NULL); + file = flist->files[ndx - flist->ndx_start]; + assert(file->flags & FLAG_HLINKED); + finish_hard_link(file, f_name(file, fbuf), ndx, NULL, itemizing, code, -1); + flist->in_progress--; + continue; + } #endif - while (check_redo && (ndx = get_redo_num()) != -1) { - csum_length = SUM_LENGTH; - max_size = -max_size; - min_size = -min_size; - ignore_existing = -ignore_existing; - ignore_non_existing = -ignore_non_existing; - update_only = -update_only; - always_checksum = -always_checksum; - size_only = -size_only; - append_mode = -append_mode; - make_backups = -make_backups; /* avoid dup backup w/inplace */ - ignore_times++; - - flist = cur_flist; - cur_flist = flist_for_ndx(ndx); - - file = cur_flist->files[ndx - cur_flist->ndx_start]; - if (solo_file) - strlcpy(fbuf, solo_file, sizeof fbuf); - else - f_name(file, fbuf); - recv_generator(fbuf, file, ndx, itemizing, code, sock_f_out); - cur_flist->to_redo--; - - cur_flist = flist; - - csum_length = SHORT_SUM_LENGTH; - max_size = -max_size; - min_size = -min_size; - ignore_existing = -ignore_existing; - ignore_non_existing = -ignore_non_existing; - update_only = -update_only; - always_checksum = -always_checksum; - size_only = -size_only; - append_mode = -append_mode; - make_backups = -make_backups; - ignore_times--; - } - - while (cur_flist != first_flist) { /* only possible with inc_recurse */ + if (check_redo && (ndx = get_redo_num()) != -1) { + csum_length = SUM_LENGTH; + max_size = -max_size; + min_size = -min_size; + ignore_existing = -ignore_existing; + ignore_non_existing = -ignore_non_existing; + update_only = -update_only; + always_checksum = -always_checksum; + size_only = -size_only; + append_mode = -append_mode; + make_backups = -make_backups; /* avoid dup backup w/inplace */ + ignore_times++; + + flist = cur_flist; + cur_flist = flist_for_ndx(ndx); + + file = cur_flist->files[ndx - cur_flist->ndx_start]; + if (solo_file) + strlcpy(fbuf, solo_file, sizeof fbuf); + else + f_name(file, fbuf); + recv_generator(fbuf, file, ndx, itemizing, code, sock_f_out); + cur_flist->to_redo--; + + cur_flist = flist; + + csum_length = SHORT_SUM_LENGTH; + max_size = -max_size; + min_size = -min_size; + ignore_existing = -ignore_existing; + ignore_non_existing = -ignore_non_existing; + update_only = -update_only; + always_checksum = -always_checksum; + size_only = -size_only; + append_mode = -append_mode; + make_backups = -make_backups; + ignore_times--; + continue; + } + + if (cur_flist == first_flist) + break; + + /* We only get here if inc_recurse is enabled. */ if (first_flist->in_progress || first_flist->to_redo) break; -- 2.34.1