diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-08-03 21:47:19 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-08-03 21:47:19 +0300 |
commit | f446f2253de6d013e3dfaa7fcc3e9b6c5fbe520e (patch) | |
tree | 5a3b55c15c2cd429a110b5477c771a516f4af16b /src | |
parent | b30e94c0aca10b57ce734f7fcf9b7600537dc136 (diff) | |
download | apk-tools-f446f2253de6d013e3dfaa7fcc3e9b6c5fbe520e.tar.gz apk-tools-f446f2253de6d013e3dfaa7fcc3e9b6c5fbe520e.tar.bz2 apk-tools-f446f2253de6d013e3dfaa7fcc3e9b6c5fbe520e.tar.xz apk-tools-f446f2253de6d013e3dfaa7fcc3e9b6c5fbe520e.zip |
extract: fix --force-overwrite
Directories are handled specially in package installation code, but
extract applet uses also apk_extract_file() to create directories.
These should not be unlinked as that fails with unexpected error code
terminating the extraction.
Diffstat (limited to 'src')
-rw-r--r-- | src/extract.c | 2 |
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; } |