Code

fix potential deadlock in create_one_file
authorAlex Riesen <raa.lkml@gmail.com>
Thu, 5 Jan 2006 09:00:12 +0000 (10:00 +0100)
committerJunio C Hamano <junkio@cox.net>
Fri, 6 Jan 2006 01:22:49 +0000 (17:22 -0800)
It can happen if the temporary file already exists (i.e. after a panic
and reboot).

Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
Signed-off-by: Junio C Hamano <junkio@cox.net>
apply.c

diff --git a/apply.c b/apply.c
index 9eba034e5d77bd54c7b6343ad54fb3626aa59c37..c471a82e83691b152c2b80ea25310afef9b0db95 100644 (file)
--- a/apply.c
+++ b/apply.c
@@ -1635,7 +1635,8 @@ static void create_one_file(const char *path, unsigned mode, const char *buf, un
                        }
                        if (errno != EEXIST)
                                break;
-               }                       
+                       ++nr;
+               }
        }
        die("unable to write file %s mode %o", path, mode);
 }