From 18846bd08390e6ae52a0de0f94ff2a0f62aad4d7 Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Mon, 10 Apr 2023 20:22:04 +0300 Subject: audit: add a new --full mode --- src/database.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/database.c') diff --git a/src/database.c b/src/database.c index 282e3a0..140a9ef 100644 --- a/src/database.c +++ b/src/database.c @@ -341,7 +341,7 @@ struct apk_db_dir *apk_db_dir_get(struct apk_database *db, apk_blob_t name) } else if (apk_blob_rsplit(name, '/', &bparent, NULL)) { dir->parent = apk_db_dir_get(db, bparent); dir->protect_mode = dir->parent->protect_mode; - dir->has_protected_children = (dir->protect_mode != APK_PROTECT_NONE); + dir->has_protected_children = !apk_protect_mode_none(dir->protect_mode); ppaths = dir->parent->protected_paths; } else { dir->parent = apk_db_dir_get(db, APK_BLOB_NULL); @@ -372,7 +372,7 @@ struct apk_db_dir *apk_db_dir_get(struct apk_database *db, apk_blob_t name) dir->protect_mode = ppath->protect_mode; } - dir->has_protected_children |= (ppath->protect_mode != APK_PROTECT_NONE); + dir->has_protected_children |= !apk_protect_mode_none(ppath->protect_mode); } return dir; @@ -1287,7 +1287,7 @@ static int add_protected_path(void *ctx, apk_blob_t blob) case '#': return 0; case '-': - protect_mode = APK_PROTECT_NONE; + protect_mode = APK_PROTECT_IGNORE; break; case '+': protect_mode = APK_PROTECT_CHANGED; @@ -2735,7 +2735,7 @@ static void apk_db_purge_pkg(struct apk_database *db, }; hash = apk_blob_hash_seed(key.filename, diri->dir->hash); if (!is_installed || - (diri->dir->protect_mode == APK_PROTECT_NONE) || + apk_protect_mode_none(diri->dir->protect_mode) || (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 && @@ -2799,7 +2799,7 @@ static void apk_db_migrate_files(struct apk_database *db, /* File was from overlay, delete the * packages version */ unlinkat(db->root_fd, tmpname, 0); - } else if ((diri->dir->protect_mode != APK_PROTECT_NONE) && + } else if (!apk_protect_mode_none(diri->dir->protect_mode) && (r == 0) && (ofile == NULL || ofile->csum.type == APK_CHECKSUM_NONE || -- cgit v1.2.3-60-g2f50