aboutsummaryrefslogtreecommitdiff
path: root/builtin-apply.c
diff options
context:
space:
mode:
Diffstat (limited to 'builtin-apply.c')
-rw-r--r--builtin-apply.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin-apply.c b/builtin-apply.c
index fd92ef717..94311e7af 100644
--- a/builtin-apply.c
+++ b/builtin-apply.c
@@ -2416,8 +2416,7 @@ static void create_one_file(char *path, unsigned mode, const char *buf, unsigned
* used to be.
*/
struct stat st;
- errno = 0;
- if (!lstat(path, &st) && S_ISDIR(st.st_mode) && !rmdir(path))
+ if (!lstat(path, &st) && (!S_ISDIR(st.st_mode) || !rmdir(path)))
errno = EEXIST;
}