diff options
author | Timo Teräs <timo.teras@iki.fi> | 2021-11-05 13:20:19 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-11-09 21:50:11 +0200 |
commit | a6736532001fd625f1ab3dd82abc2a4c5366c79c (patch) | |
tree | 47ead4bc00519f0b1e3ea52bf576da5bb8b66530 /src/app_extract.c | |
parent | d441cf523cea6ab2d2ee1c0f50fab0bb620f2ea1 (diff) | |
download | apk-tools-a6736532001fd625f1ab3dd82abc2a4c5366c79c.tar.gz apk-tools-a6736532001fd625f1ab3dd82abc2a4c5366c79c.tar.bz2 apk-tools-a6736532001fd625f1ab3dd82abc2a4c5366c79c.tar.xz apk-tools-a6736532001fd625f1ab3dd82abc2a4c5366c79c.zip |
database: implement uvol support
by adding an abstraction layer to the file system
Diffstat (limited to 'src/app_extract.c')
-rw-r--r-- | src/app_extract.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/app_extract.c b/src/app_extract.c index 2dd310b..fea4924 100644 --- a/src/app_extract.c +++ b/src/app_extract.c @@ -15,6 +15,7 @@ #include "apk_applet.h" #include "apk_print.h" #include "apk_extract.h" +#include "apk_fs.h" struct extract_ctx { const char *destination; @@ -22,7 +23,6 @@ struct extract_ctx { struct apk_extract_ctx ectx; struct apk_ctx *ac; - int root_fd; }; @@ -41,7 +41,7 @@ static int option_parse_applet(void *pctx, struct apk_ctx *ac, int opt, const ch ctx->destination = optarg; break; case OPT_EXTRACT_no_chown: - ctx->extract_flags |= APK_EXTRACTF_NO_CHOWN; + ctx->extract_flags |= APK_FSEXTRACTF_NO_CHOWN; break; default: return -ENOTSUP; @@ -66,8 +66,7 @@ static int extract_file(struct apk_extract_ctx *ectx, const struct apk_file_info apk_dbg2(out, "%s", fi->name); - return apk_extract_file(ctx->root_fd, fi, 0, 0, is, 0, 0, - ctx->extract_flags, ectx->ac); + return apk_fs_extract(ctx->ac, fi, is, 0, 0, ctx->extract_flags, APK_BLOB_NULL); } static const struct apk_extract_ops extract_ops = { @@ -84,10 +83,11 @@ static int extract_main(void *pctx, struct apk_ctx *ac, struct apk_string_array int r = 0; ctx->ac = ac; - if (!(ac->force & APK_FORCE_OVERWRITE)) ctx->extract_flags |= APK_EXTRACTF_NO_OVERWRITE; + if (!(ac->force & APK_FORCE_OVERWRITE)) ctx->extract_flags |= APK_FSEXTRACTF_NO_OVERWRITE; if (!ctx->destination) ctx->destination = "."; - ctx->root_fd = openat(AT_FDCWD, ctx->destination, O_RDONLY); - if (ctx->root_fd < 0) { + + ac->dest_fd = openat(AT_FDCWD, ctx->destination, O_RDONLY); + if (ac->dest_fd < 0) { r = -errno; apk_err(out, "Error opening destination '%s': %s", ctx->destination, apk_error_str(r)); @@ -103,7 +103,7 @@ static int extract_main(void *pctx, struct apk_ctx *ac, struct apk_string_array break; } } - close(ctx->root_fd); + close(ac->dest_fd); return r; } |