summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/extract.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/extract.c b/src/extract.c
index c5169be..1e092c5 100644
--- a/src/extract.c
+++ b/src/extract.c
@@ -23,7 +23,7 @@ int apk_extract_file(int atfd, const struct apk_file_info *ae,
const char *fn = extract_name ?: ae->name;
int fd, r = -1, atflags = 0, ret = 0;
- if (!(extract_flags & APK_EXTRACTF_NO_OVERWRITE)) {
+ if (!S_ISDIR(ae->mode) && !(extract_flags & APK_EXTRACTF_NO_OVERWRITE)) {
if (unlinkat(atfd, fn, 0) != 0 && errno != ENOENT) return -errno;
}