]> git.proxmox.com Git - libgit2.git/commitdiff
git_futils_rmdir: only allow `EBUSY` when asked
authorEdward Thomson <ethomson@edwardthomson.com>
Sat, 10 Jun 2017 17:46:35 +0000 (18:46 +0100)
committerEdward Thomson <ethomson@edwardthomson.com>
Sat, 10 Jun 2017 18:18:57 +0000 (19:18 +0100)
Only ignore `EBUSY` from `rmdir` when the `GIT_RMDIR_SKIP_NONEMPTY` bit
is set.

src/fileops.c

index f9552a5f828b1b999da6a11c87cc113148af209c..2f86ba1e480203088db25fafd5a36ff64eb54392 100644 (file)
@@ -766,6 +766,9 @@ static int futils__rmdir_empty_parent(void *opaque, const char *path)
 
                if (en == ENOENT || en == ENOTDIR) {
                        /* do nothing */
+               } else if ((data->flags & GIT_RMDIR_SKIP_NONEMPTY) == 0 &&
+                       en == EBUSY) {
+                       error = git_path_set_error(errno, path, "rmdir");
                } else if (en == ENOTEMPTY || en == EEXIST || en == EBUSY) {
                        error = GIT_ITEROVER;
                } else {