summaryrefslogtreecommitdiff
path: root/src/audit.c
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-11-01 20:18:57 +0200
committerTimo Teräs <timo.teras@iki.fi>2014-11-01 20:18:57 +0200
commit4f823f2a50646d64c506ad8b28ce7e672a87d2ec (patch)
treecd305cb95d799b4c0f01352693c5e547f77016ba /src/audit.c
parent36d5b91495e22fe8425277f2d793fd4a284ee2b6 (diff)
downloadapk-tools-4f823f2a50646d64c506ad8b28ce7e672a87d2ec.tar.gz
apk-tools-4f823f2a50646d64c506ad8b28ce7e672a87d2ec.tar.bz2
apk-tools-4f823f2a50646d64c506ad8b28ce7e672a87d2ec.tar.xz
apk-tools-4f823f2a50646d64c506ad8b28ce7e672a87d2ec.zip
make 'mode, uid, gid' triplet separate atomized struct
there are only few combinations for that triplet, and they occur multiple times reducing the struct sizes a bit. make sane defaults and prepare to not write defaults to disk to reduce on-disk installed db size.
Diffstat (limited to 'src/audit.c')
-rw-r--r--src/audit.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/audit.c b/src/audit.c
index 0d1ca5c..e7440de 100644
--- a/src/audit.c
+++ b/src/audit.c
@@ -97,7 +97,7 @@ static int audit_file(struct audit_ctx *actx,
if (dbf == NULL)
return 'A';
- dbf->mode |= S_SEENFLAG;
+ dbf->audited = 1;
if (apk_file_get_info(dirfd, name, APK_FI_NOFOLLOW | dbf->csum.type, &fi) != 0)
return -EPERM;
@@ -109,11 +109,10 @@ static int audit_file(struct audit_ctx *actx,
if (S_ISLNK(fi.mode) && dbf->csum.type == APK_CHECKSUM_NONE)
return 'U';
- if (actx->check_permissions &&
- (dbf->mode != 0 || dbf->uid != 0 || dbf->gid != 0)) {
- if ((fi.mode & 07777) != (dbf->mode & 07777))
+ if (actx->check_permissions) {
+ if ((fi.mode & 07777) != (dbf->acl->mode & 07777))
return 'M';
- if (fi.uid != dbf->uid || fi.gid != dbf->gid)
+ if (fi.uid != dbf->acl->uid || fi.gid != dbf->acl->gid)
return 'M';
}
@@ -293,8 +292,7 @@ static int audit_missing_files(apk_hash_item item, void *pctx)
char path[PATH_MAX];
int len;
- if (file->mode & S_SEENFLAG)
- return 0;
+ if (file->audited) return 0;
dir = file->diri->dir;
if (dir->mode & S_SEENFLAG) {