Skip to content

Commit 7348159

Browse files
committed
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
2 parents 1bfe99e + a83b2b5 commit 7348159

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

compat/mingw.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ int mingw_rmdir(const char *pathname)
256256

257257
while ((ret = rmdir(pathname)) == -1 && tries < ARRAY_SIZE(delay)) {
258258
if (!is_file_in_use_error(GetLastError()))
259+
errno = err_win_to_posix(GetLastError());
260+
if (errno != EACCES)
259261
break;
260262
if (!is_dir_empty(pathname)) {
261263
errno = ENOTEMPTY;
@@ -271,7 +273,7 @@ int mingw_rmdir(const char *pathname)
271273
Sleep(delay[tries]);
272274
tries++;
273275
}
274-
while (ret == -1 && is_file_in_use_error(GetLastError()) &&
276+
while (ret == -1 && errno == EACCES && is_file_in_use_error(GetLastError()) &&
275277
ask_yes_no_if_possible("Deletion of directory '%s' failed. "
276278
"Should I try again?", pathname))
277279
ret = rmdir(pathname);

0 commit comments

Comments
 (0)