[PATCH] mingw_rmdir: do not prompt for retry when non-empty

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 simply returning from the function instead of breaking
the loop.

While we're at it, change the second break to a return as well; we
already know that we won't enter the prompting-loop, beacuse
is_file_in_use_error(GetLastError()) already evaluated to false.

Signed-off-by: Erik Faye-Lund <kusmabite@xxxxxxxxx>
---

Here's a quick patch for a small issue I recently encountered; when
deleting a file from inside a directory, we currently end up
prompting the user if (s)he want us to retry deleting the directory
they are in.

 compat/mingw.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/compat/mingw.c b/compat/mingw.c
index 1eb974f..2c29667 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -260,10 +260,10 @@ int mingw_rmdir(const char *pathname)
 
 	while ((ret = _wrmdir(wpathname)) == -1 && tries < ARRAY_SIZE(delay)) {
 		if (!is_file_in_use_error(GetLastError()))
-			break;
+			return ret;
 		if (!is_dir_empty(wpathname)) {
 			errno = ENOTEMPTY;
-			break;
+			return ret;
 		}
 		/*
 		 * We assume that some other process had the source or
-- 
1.8.0.msysgit.0.3.g0262b9f.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]