summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2017-06-10 18:46:35 +0100
committerEdward Thomson <ethomson@edwardthomson.com>2017-06-10 19:18:57 +0100
commit4a0df574114f331a2428278c5f72aae7a49fa214 (patch)
tree662bb4f042fa5953aab7f25e2325be55d917ed7b
parent83989d70ecd39324a9c262e75ce27b6a33cf78fc (diff)
downloadlibgit2-ethomson/forced_checkout_2.tar.gz
git_futils_rmdir: only allow `EBUSY` when askedethomson/forced_checkout_2
Only ignore `EBUSY` from `rmdir` when the `GIT_RMDIR_SKIP_NONEMPTY` bit is set.
-rw-r--r--src/fileops.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/fileops.c b/src/fileops.c
index f9552a5f8..2f86ba1e4 100644
--- a/src/fileops.c
+++ b/src/fileops.c
@@ -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 {