summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2012-12-11 15:51:14 -0800
committerJunio C Hamano <gitster@pobox.com>2012-12-11 15:51:14 -0800
commit73481593800a4aa17eb6a3d8c5740485735d3686 (patch)
tree0b485377df2faad83deb3e2e9cef6989748b5426 /compat/mingw.c
parent1bfe99ed3648cbc019d32eff50e6430f252eb96f (diff)
parenta83b2b578c04a2abe33a586ec9c64e75ef5bc819 (diff)
downloadgit-73481593800a4aa17eb6a3d8c5740485735d3686.tar.gz
Merge branch 'ef/mingw-rmdir'
MinGW has a workaround when rmdir unnecessarily fails to retry with a prompt, but the logic was kicking in when the rmdir failed with ENOTEMPTY, i.e. was expected to fail and there is no point retrying. * ef/mingw-rmdir: mingw_rmdir: do not prompt for retry when non-empty
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 34724c2781..b673625580 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -256,6 +256,8 @@ int mingw_rmdir(const char *pathname)
while ((ret = rmdir(pathname)) == -1 && tries < ARRAY_SIZE(delay)) {
if (!is_file_in_use_error(GetLastError()))
+ errno = err_win_to_posix(GetLastError());
+ if (errno != EACCES)
break;
if (!is_dir_empty(pathname)) {
errno = ENOTEMPTY;
@@ -271,7 +273,7 @@ int mingw_rmdir(const char *pathname)
Sleep(delay[tries]);
tries++;
}
- while (ret == -1 && is_file_in_use_error(GetLastError()) &&
+ while (ret == -1 && errno == EACCES && is_file_in_use_error(GetLastError()) &&
ask_yes_no_if_possible("Deletion of directory '%s' failed. "
"Should I try again?", pathname))
ret = rmdir(pathname);