summaryrefslogtreecommitdiff
path: root/src/apk_database.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-11-22 10:33:07 +0200
committerTimo Teräs <timo.teras@iki.fi>2021-11-22 10:35:18 +0200
commitcce62390741f5d2dd62fcb708564b4e00666f65b (patch)
treec9453548cf5875c038bf79e4e34472f85b0ff4fb /src/apk_database.h
parent83b71f0bafeac4b2e7d48cba408014d13a89d614 (diff)
downloadapk-tools-cce62390741f5d2dd62fcb708564b4e00666f65b.tar.gz
apk-tools-cce62390741f5d2dd62fcb708564b4e00666f65b.tar.bz2
apk-tools-cce62390741f5d2dd62fcb708564b4e00666f65b.tar.xz
apk-tools-cce62390741f5d2dd62fcb708564b4e00666f65b.zip
db: fix regression in creating .apk-new files
The apk_fsdir_file_digest() servers dual purpose: to calculate the checksum, but also to determine if the file exists. Move it's error check where it originally was. fixes #10791
Diffstat (limited to 'src/apk_database.h')
-rw-r--r--src/apk_database.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/apk_database.h b/src/apk_database.h
index ff94762..5958d6f 100644
--- a/src/apk_database.h
+++ b/src/apk_database.h
@@ -241,7 +241,9 @@ void apk_name_foreach_matching(struct apk_database *db, struct apk_string_array
static inline uint8_t apk_dbf_digest(struct apk_db_file *dbf)
{
- uint8_t alg = apk_digest_alg_by_len(dbf->csum.type);
+ uint8_t alg;
+ if (!dbf) return APK_DIGEST_NONE;
+ alg = apk_digest_alg_by_len(dbf->csum.type);
if (alg == APK_DIGEST_SHA1 && dbf->diri->pkg->ipkg->sha256_160)
alg = APK_DIGEST_SHA256_160;
return alg;