summaryrefslogtreecommitdiff
path: root/src/app_extract.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-08-17 13:53:01 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-08-17 13:58:20 +0300
commita46043bcc4cc15b456ef1eac5c5f9d93bd905d53 (patch)
treef5d80544e6a4b53f05a9615a396e4b08650e40ec /src/app_extract.c
parentf446f2253de6d013e3dfaa7fcc3e9b6c5fbe520e (diff)
downloadapk-tools-a46043bcc4cc15b456ef1eac5c5f9d93bd905d53.tar.gz
apk-tools-a46043bcc4cc15b456ef1eac5c5f9d93bd905d53.tar.bz2
apk-tools-a46043bcc4cc15b456ef1eac5c5f9d93bd905d53.tar.xz
apk-tools-a46043bcc4cc15b456ef1eac5c5f9d93bd905d53.zip
extract: fix directory handling
'is' is null for directories
Diffstat (limited to 'src/app_extract.c')
-rw-r--r--src/app_extract.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/app_extract.c b/src/app_extract.c
index 75034bf..7c3fa58 100644
--- a/src/app_extract.c
+++ b/src/app_extract.c
@@ -146,13 +146,14 @@ static int extract_file(struct apk_extract_ctx *ectx, const struct apk_file_info
apk_dbg2(out, "%s", fi->name);
- if (fi->uvol_name) return apk_extract_volume(ectx->ac, fi, is);
-
- r = apk_extract_file(ctx->root_fd, fi, 0, 0, is, 0, 0, 0,
- ctx->extract_flags, &ectx->ac->out);
- r = apk_istream_close_error(is, r);
-
- if (r != 0) unlinkat(ctx->root_fd, fi->name, 0);
+ if (fi->uvol_name && is) {
+ r = apk_extract_volume(ectx->ac, fi, is);
+ } else {
+ r = apk_extract_file(ctx->root_fd, fi, 0, 0, is, 0, 0, 0,
+ ctx->extract_flags, &ectx->ac->out);
+ if (r != 0) unlinkat(ctx->root_fd, fi->name, 0);
+ }
+ if (is) r = apk_istream_close_error(is, r);
return r;
}