From: Wayne Davison Date: Sat, 3 Nov 2007 15:27:14 +0000 (+0000) Subject: Fixed hang when --hard-links was processing a large directory X-Git-Url: https://mattmccutchen.net/rsync/rsync.git/commitdiff_plain/c0685c05f871261a0adb66cc22b3e0d50717a648 Fixed hang when --hard-links was processing a large directory hierarchy with no files. --- diff --git a/generator.c b/generator.c index db0824df..24435ea6 100644 --- a/generator.c +++ b/generator.c @@ -2027,8 +2027,14 @@ void generate_files(int f_out, const char *local_name) do { #ifdef SUPPORT_HARD_LINKS if (preserve_hard_links && inc_recurse) { - while (!flist_eof && file_total < FILECNT_LOOKAHEAD/2) + while (!flist_eof) { + int cnt = first_flist->prev + ? first_flist->prev->ndx_end - first_flist->ndx_start + 1 + : first_flist->ndx_end - first_flist->ndx_start + 1; + if (cnt >= FILECNT_LOOKAHEAD/2) + break; wait_for_receiver(); + } } #endif