diff options
author | Timo Teräs <timo.teras@iki.fi> | 2022-03-06 16:15:53 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2022-03-06 16:15:53 +0200 |
commit | b5da1ccf4cb036f54208306f66be1e8098f4259e (patch) | |
tree | d0d7417c981ac6efa5071deb06146b4e02aeae36 /src | |
parent | 00e397d5646df33e2823d73e2388013d461ed5e9 (diff) | |
download | apk-tools-b5da1ccf4cb036f54208306f66be1e8098f4259e.tar.gz apk-tools-b5da1ccf4cb036f54208306f66be1e8098f4259e.tar.bz2 apk-tools-b5da1ccf4cb036f54208306f66be1e8098f4259e.tar.xz apk-tools-b5da1ccf4cb036f54208306f66be1e8098f4259e.zip |
mkpkg: check apk_ostream_to_file/adb_compress error
fixes #10823
Diffstat (limited to 'src')
-rw-r--r-- | src/app_mkpkg.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/app_mkpkg.c b/src/app_mkpkg.c index afbc150..57006c8 100644 --- a/src/app_mkpkg.c +++ b/src/app_mkpkg.c @@ -316,6 +316,11 @@ static int mkpkg_main(void *pctx, struct apk_ctx *ac, struct apk_string_array *a // construct package with ADB as header, and the file data in // concatenated data blocks os = adb_compress(apk_ostream_to_file(AT_FDCWD, ctx->output, 0644), ADB_COMP_DEFLATE); + if (IS_ERR(os)) { + r = PTR_ERR(os); + goto err; + } + adb_c_adb(os, &ctx->db, trust); int files_fd = openat(AT_FDCWD, ctx->files_dir, O_RDONLY); for (i = ADBI_FIRST; i <= adb_ra_num(&ctx->paths); i++) { @@ -350,7 +355,7 @@ static int mkpkg_main(void *pctx, struct apk_ctx *ac, struct apk_string_array *a err: adb_free(&ctx->db); - if (r) apk_err(out, "failed to create package: %s", apk_error_str(r)); + if (r) apk_err(out, "failed to create package: %s: %s", ctx->output, apk_error_str(r)); return r; } |