summaryrefslogtreecommitdiff
path: root/src/database.c
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-03 16:06:04 +0200
commitd441cf523cea6ab2d2ee1c0f50fab0bb620f2ea1 (patch)
treea8f43d163500929aa17d79c0b0f8958842597212 /src/database.c
parent5c0c249b7823e8537b9e60108e565b9b9a0bff24 (diff)
downloadapk-tools-d441cf523cea6ab2d2ee1c0f50fab0bb620f2ea1.tar.gz
apk-tools-d441cf523cea6ab2d2ee1c0f50fab0bb620f2ea1.tar.bz2
apk-tools-d441cf523cea6ab2d2ee1c0f50fab0bb620f2ea1.tar.xz
apk-tools-d441cf523cea6ab2d2ee1c0f50fab0bb620f2ea1.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.
Diffstat (limited to 'src/database.c')
-rw-r--r--src/database.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/database.c b/src/database.c
index d145425..f5c8d8c 100644
--- a/src/database.c
+++ b/src/database.c
@@ -2657,7 +2657,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) ||
(db->ctx->flags & APK_PURGE) ||
(file->csum.type != APK_CHECKSUM_NONE &&
apk_fileinfo_get(db->root_fd, name, APK_FI_NOFOLLOW | APK_FI_DIGEST(apk_dbf_digest(file)), &fi, &db->atoms) == 0 &&