aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--compat/mingw.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 0e8807196f..b1cc30d0f1 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -338,9 +338,16 @@ int mingw_unlink(const char *pathname, int handle_in_use_error)
return 0;
if (!is_file_in_use_error(GetLastError()))
break;
+ /*
+ * _wunlink() / DeleteFileW() for directory symlinks fails with
+ * ERROR_ACCESS_DENIED (EACCES), so try _wrmdir() as well. This is the
+ * same error we get if a file is in use (already checked above).
+ */
+ if (!_wrmdir(wpathname))
+ return 0;
+
if (!handle_in_use_error)
return -1;
-
} while (retry_ask_yes_no(&tries, "Unlink of file '%s' failed. "
"Should I try again?", pathname));
return -1;