From b026f3c811b6644bf6826532f51dd3d0bc59efa2 Mon Sep 17 00:00:00 2001 From: Enrico Giordani Date: Tue, 1 Sep 2015 13:31:00 +0200 Subject: [PATCH] [Fix] replace_rename() had an infinite loop upon error. --- src/Win32_Interop/win32fixes.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Win32_Interop/win32fixes.c b/src/Win32_Interop/win32fixes.c index 42642911..6d44cf5e 100644 --- a/src/Win32_Interop/win32fixes.c +++ b/src/Win32_Interop/win32fixes.c @@ -109,12 +109,14 @@ int replace_rename(const char *src, const char *dst) { return 0; } else { errno = GetLastError(); - if (errno != 5) break; + if (errno != 5) { + break; + } retries--; if (retries == 0) { - retries = 50; - Sleep(10); + break; } + Sleep(10); } } /* On error we will return generic error code without GetLastError() */