summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2021-11-03 16:05:21 +0200
committerTimo Teräs <timo.teras@iki.fi>2021-11-12 13:13:43 +0200
commit3aa64ea1e7484a4c4d17cf6bbca3c3f6897ba976 (patch)
treec220d2187ab84017cf6bef1ae1bd77a49ae56955
parent390b7d1049d4aefb4ead8f4236e406a41536efb9 (diff)
downloadapk-tools-3aa64ea1e7484a4c4d17cf6bbca3c3f6897ba976.tar.gz
apk-tools-3aa64ea1e7484a4c4d17cf6bbca3c3f6897ba976.tar.bz2
apk-tools-3aa64ea1e7484a4c4d17cf6bbca3c3f6897ba976.tar.xz
apk-tools-3aa64ea1e7484a4c4d17cf6bbca3c3f6897ba976.zip
db: purge temporary files without explicit modification check
When extraction failed, the user has had no opportunity to edit any files. Just clean up.
-rw-r--r--src/database.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index 5a98d56..f059412 100644
--- a/src/database.c
+++ b/src/database.c
@@ -2685,7 +2685,8 @@ static void apk_db_purge_pkg(struct apk_database *db,
.filename = APK_BLOB_PTR_LEN(file->name, file->namelen),
};
hash = apk_blob_hash_seed(key.filename, diri->dir->hash);
- if ((diri->dir->protect_mode == APK_PROTECT_NONE) ||
+ if (!is_installed ||
+ (diri->dir->protect_mode == APK_PROTECT_NONE) ||
(apk_flags & APK_PURGE) ||
(file->csum.type != APK_CHECKSUM_NONE &&
apk_fileinfo_get(db->root_fd, name, APK_FI_NOFOLLOW | file->csum.type, &fi, &db->atoms) == 0 &&