summaryrefslogtreecommitdiff
path: root/src/audit.c
diff options
context:
space:
mode:
authorTimo Teras <timo.teras@iki.fi>2009-07-30 11:55:59 +0300
committerTimo Teras <timo.teras@iki.fi>2009-07-30 11:55:59 +0300
commitc1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7 (patch)
treeca38a4df58d627d6b1973e93ff810ac27abde7ea /src/audit.c
parent02cb0d2f8f3fa7e2bc8005160f0baec81bed69d2 (diff)
downloadapk-tools-c1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7.tar.gz
apk-tools-c1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7.tar.bz2
apk-tools-c1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7.tar.xz
apk-tools-c1fe6d08f3ba77bf13b098216fc5e5bcd4ba23f7.zip
db: fix checksum storing to db
also take precautions in audit code if the db is missing the checksum.
Diffstat (limited to 'src/audit.c')
-rw-r--r--src/audit.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/audit.c b/src/audit.c
index 31965df..76bd492 100644
--- a/src/audit.c
+++ b/src/audit.c
@@ -69,10 +69,9 @@ static int audit_directory(apk_hash_item item, void *ctx)
} else {
dbf = apk_db_file_query(db, bdir, APK_BLOB_STR(de->d_name));
if (dbf != NULL) {
- if (apk_file_get_info(tmp, dbf->csum.type, &fi) < 0)
- continue;
-
- if (apk_checksum_compare(&fi.csum, &dbf->csum) == 0)
+ if (dbf->csum.type != APK_CHECKSUM_NONE &&
+ apk_file_get_info(tmp, dbf->csum.type, &fi) == 0 &&
+ apk_checksum_compare(&fi.csum, &dbf->csum) == 0)
continue;
reason = 'U';