summaryrefslogtreecommitdiff
path: root/src/app_mkndx.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-07-16 19:01:41 +0300
committerTimo Teräs <timo.teras@iki.fi>2021-07-22 15:30:08 +0300
commit3b00c0dc808f4b6c3809c91a67709ca2d7bf8865 (patch)
tree2700fe81689ae7210516196b8db58cf987536fba /src/app_mkndx.c
parent69bcdd23b94dab9e0ef67bd480e7f875b06dc71d (diff)
downloadapk-tools-3b00c0dc808f4b6c3809c91a67709ca2d7bf8865.tar.gz
apk-tools-3b00c0dc808f4b6c3809c91a67709ca2d7bf8865.tar.bz2
apk-tools-3b00c0dc808f4b6c3809c91a67709ca2d7bf8865.tar.xz
apk-tools-3b00c0dc808f4b6c3809c91a67709ca2d7bf8865.zip
adb: unify various interfaces to adb_m_process
Removes code duplication, and puts important checks in one place. Support seamless decompression in adbdump.
Diffstat (limited to 'src/app_mkndx.c')
-rw-r--r--src/app_mkndx.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/app_mkndx.c b/src/app_mkndx.c
index 4599fd3..bab6983 100644
--- a/src/app_mkndx.c
+++ b/src/app_mkndx.c
@@ -204,6 +204,7 @@ static int mkndx_main(void *pctx, struct apk_ctx *ac, struct apk_string_array *a
return -1;
}
+ adb_init(&odb);
adb_w_init_tmp(&tmpdb, 200);
adb_wo_alloca(&tmpl, &schema_pkginfo, &tmpdb);
@@ -215,7 +216,8 @@ static int mkndx_main(void *pctx, struct apk_ctx *ac, struct apk_string_array *a
apk_fileinfo_get(AT_FDCWD, ctx->index, 0, &fi, 0);
index_mtime = fi.mtime;
- r = adb_m_map(&odb, open(ctx->index, O_RDONLY), ADB_SCHEMA_INDEX, trust);
+ r = adb_m_open(&odb, apk_istream_from_file_mmap(AT_FDCWD, ctx->index),
+ ADB_SCHEMA_INDEX, trust);
if (r) {
apk_err(out, "%s: %s", ctx->index, apk_error_str(r));
return r;