File tree Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Expand file tree Collapse file tree 3 files changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -201,8 +201,12 @@ int uname(struct utsname *buf);
201
201
* replacements of existing functions
202
202
*/
203
203
204
- int mingw_unlink (const char * pathname );
205
- #define unlink mingw_unlink
204
+ int mingw_unlink (const char * pathname , int handle_in_use_error );
205
+ #ifdef MINGW_DONT_HANDLE_IN_USE_ERROR
206
+ # define unlink (path ) mingw_unlink(path, 0)
207
+ #else
208
+ # define unlink (path ) mingw_unlink(path, 1)
209
+ #endif
206
210
207
211
int mingw_rmdir (const char * path );
208
212
#define rmdir mingw_rmdir
Original file line number Diff line number Diff line change @@ -302,7 +302,7 @@ static wchar_t *normalize_ntpath(wchar_t *wbuf)
302
302
return wbuf ;
303
303
}
304
304
305
- int mingw_unlink (const char * pathname )
305
+ int mingw_unlink (const char * pathname , int handle_in_use_error )
306
306
{
307
307
int ret , tries = 0 ;
308
308
wchar_t wpathname [MAX_PATH ];
@@ -317,6 +317,9 @@ int mingw_unlink(const char *pathname)
317
317
while ((ret = _wunlink (wpathname )) == -1 && tries < ARRAY_SIZE (delay )) {
318
318
if (!is_file_in_use_error (GetLastError ()))
319
319
break ;
320
+ if (!handle_in_use_error )
321
+ return ret ;
322
+
320
323
/*
321
324
* We assume that some other process had the source or
322
325
* destination file open at the wrong moment and retry.
Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ license that can be found in the LICENSE file or at
11
11
12
12
/* This header glues the reftable library to the rest of Git */
13
13
14
+ #define MINGW_DONT_HANDLE_IN_USE_ERROR
14
15
#include "compat/posix.h"
15
16
#include "compat/zlib-compat.h"
16
17
You can’t perform that action at this time.
0 commit comments