summaryrefslogtreecommitdiff
path: root/src/database.c
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/database.c
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/database.c')
-rw-r--r--src/database.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/database.c b/src/database.c
index 4bb23dd..f31c552 100644
--- a/src/database.c
+++ b/src/database.c
@@ -2658,10 +2658,10 @@ static void apk_db_migrate_files(struct apk_database *db,
if (ofile && ofile->diri->pkg->name == NULL) {
// File was from overlay, delete the package's version
ctrl = APK_FS_CTRL_CANCEL;
- } else if ((diri->dir->protect_mode != APK_PROTECT_NONE) &&
+ } else if (diri->dir->protect_mode != APK_PROTECT_NONE &&
+ apk_fsdir_file_digest(&d, key.filename, apk_dbf_digest(ofile), &dgst) == 0 &&
(!ofile || ofile->csum.type == APK_CHECKSUM_NONE ||
- (apk_fsdir_file_digest(&d, key.filename, apk_dbf_digest(ofile), &dgst) == 0 &&
- apk_digest_cmp_csum(&dgst, &ofile->csum) != 0))) {
+ apk_digest_cmp_csum(&dgst, &ofile->csum) != 0)) {
// Protected directory, and a file without db entry
// or with local modifications. Keep the filesystem file.
// Determine if the package's file should be kept as .apk-new