summaryrefslogtreecommitdiff
path: root/compat
diff options
context:
space:
mode:
authorErik Faye-Lund <kusmabite@gmail.com>2012-12-10 14:42:27 (GMT)
committerJunio C Hamano <gitster@pobox.com>2012-12-10 16:23:53 (GMT)
commita83b2b578c04a2abe33a586ec9c64e75ef5bc819 (patch)
tree5b215f63700b0233f37d874fe2a40c7abfad0eb8 /compat
parent84adb641545f4b58f9276adf099f840ea2928e44 (diff)
downloadgit-a83b2b578c04a2abe33a586ec9c64e75ef5bc819.zip
git-a83b2b578c04a2abe33a586ec9c64e75ef5bc819.tar.gz
git-a83b2b578c04a2abe33a586ec9c64e75ef5bc819.tar.bz2
mingw_rmdir: do not prompt for retry when non-empty
in ab1a11be ("mingw_rmdir: set errno=ENOTEMPTY when appropriate"), a check was added to prevent us from retrying to delete a directory that is both in use and non-empty. However, this logic was slightly flawed; since we didn't return immediately, we end up falling out of the retry-loop, but right into the prompting-loop. Fix this by setting errno, and guarding the prompting-loop with an errno-check. Signed-off-by: Erik Faye-Lund <kusmabite@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'compat')
-rw-r--r--compat/mingw.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index 4e63838..28527ab 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);