]> git.ipfire.org Git - thirdparty/rsync.git/commitdiff
Avoid a potential hang when --remove-*-files is active.
authorWayne Davison <wayned@samba.org>
Mon, 10 Nov 2008 01:59:11 +0000 (17:59 -0800)
committerWayne Davison <wayned@samba.org>
Mon, 10 Nov 2008 02:02:11 +0000 (18:02 -0800)
io.c

diff --git a/io.c b/io.c
index 57bb70f86d546d2f48d069a4d9d6844dbaec52c4..e8d228cafa5768ba02144687fd4a9bc65251d9fa 100644 (file)
--- a/io.c
+++ b/io.c
@@ -447,9 +447,14 @@ static void read_msg_fd(void)
  * this, sender-side deletions were mostly happening at the end. */
 void increment_active_files(int ndx, int itemizing, enum logcode code)
 {
-       /* TODO: tune these limits? */
-       while (active_filecnt >= (active_bytecnt >= 128*1024 ? 10 : 50)) {
+       while (1) {
+               /* TODO: tune these limits? */
+               int limit = active_bytecnt >= 128*1024 ? 10 : 50;
+               if (active_filecnt < limit)
+                       break;
                check_for_finished_files(itemizing, code, 0);
+               if (active_filecnt < limit)
+                       break;
                if (iobuf_out_cnt)
                        io_flush(NORMAL_FLUSH);
                else