summaryrefslogtreecommitdiff
path: root/src/app_adbsign.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-10-02 15:25:12 +0300
committerTimo Teräs <timo.teras@iki.fi>2020-10-09 16:09:19 +0300
commit6d71f49c11e22a617234ef47123ab9287cde23af (patch)
tree320b27af8e13815cdb8e5e458de74a9b343a0f1a /src/app_adbsign.c
parent2156107afcd1954fd36ab1e55cf73390548e6d07 (diff)
downloadapk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.tar.gz
apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.tar.bz2
apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.tar.xz
apk-tools-6d71f49c11e22a617234ef47123ab9287cde23af.zip
io: make ostream_file always use tmpname
Diffstat (limited to 'src/app_adbsign.c')
-rw-r--r--src/app_adbsign.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/src/app_adbsign.c b/src/app_adbsign.c
index 6861776..918948f 100644
--- a/src/app_adbsign.c
+++ b/src/app_adbsign.c
@@ -64,22 +64,17 @@ static int update_signatures(struct adb_xfrm *xfrm, struct adb_block *blk, struc
static int adbsign_main(void *pctx, struct apk_database *db, struct apk_string_array *args)
{
- char tmpname[PATH_MAX];
struct sign_ctx *ctx = pctx;
char **arg;
int r;
ctx->db = db;
foreach_array_item(arg, args) {
- if (snprintf(tmpname, sizeof tmpname, "%s.tmp", *arg) >= sizeof tmpname) {
- r = ENAMETOOLONG;
- } else {
- ctx->xfrm.is = apk_istream_from_file(AT_FDCWD, *arg);
- ctx->xfrm.os = apk_ostream_to_file(AT_FDCWD, *arg, tmpname, 0644);
- adb_c_xfrm(&ctx->xfrm, update_signatures);
- apk_istream_close(ctx->xfrm.is);
- r = apk_ostream_close(ctx->xfrm.os);
- }
+ ctx->xfrm.is = apk_istream_from_file(AT_FDCWD, *arg);
+ ctx->xfrm.os = apk_ostream_to_file(AT_FDCWD, *arg, 0644);
+ adb_c_xfrm(&ctx->xfrm, update_signatures);
+ apk_istream_close(ctx->xfrm.is);
+ r = apk_ostream_close(ctx->xfrm.os);
if (r) apk_error("%s: %s", *arg, apk_error_str(r));
}