diff options
author | Timo Teräs <timo.teras@iki.fi> | 2020-05-19 11:39:21 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2020-05-19 12:02:56 +0300 |
commit | d0edeec8fb8fa5abee8b3065cea5e4882d0c51c4 (patch) | |
tree | 10dbc6d72c9cef13a26cb539df43e92e4bf78d74 /src/app_audit.c | |
parent | 12fdf6fc219321d22825042ae08efd322acc0310 (diff) | |
download | apk-tools-d0edeec8fb8fa5abee8b3065cea5e4882d0c51c4.tar.gz apk-tools-d0edeec8fb8fa5abee8b3065cea5e4882d0c51c4.tar.bz2 apk-tools-d0edeec8fb8fa5abee8b3065cea5e4882d0c51c4.tar.xz apk-tools-d0edeec8fb8fa5abee8b3065cea5e4882d0c51c4.zip |
make the atom functions not use global state
This greatly helps with memory management on applications that
may want to daemonize and open/close database several times.
Also the lifetime and "owner" of memory for all data is now
explicitly bound to owning struct apk_database, which might
be helpful when writing language bindings. As side effect, the
interned "atoms" are unique only within what apk_database, so
comparing packages from different apk_database may not work
as expected.
Fixes #10697
Diffstat (limited to 'src/app_audit.c')
-rw-r--r-- | src/app_audit.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/app_audit.c b/src/app_audit.c index fb2a0ee..011a26c 100644 --- a/src/app_audit.c +++ b/src/app_audit.c @@ -107,7 +107,7 @@ static int audit_file(struct audit_ctx *actx, APK_FI_NOFOLLOW | APK_FI_XATTR_CSUM(dbf->acl->xattr_csum.type ?: APK_CHECKSUM_DEFAULT) | APK_FI_CSUM(dbf->csum.type), - &fi) != 0) + &fi, &db->atoms) != 0) return -EPERM; if (dbf->csum.type != APK_CHECKSUM_NONE && @@ -183,7 +183,7 @@ static int audit_directory_tree_item(void *ctx, int dirfd, const char *name) int reason = 0; if (bdir.len + bent.len + 1 >= sizeof(atctx->path)) return 0; - if (apk_fileinfo_get(dirfd, name, APK_FI_NOFOLLOW, &fi) < 0) return 0; + if (apk_fileinfo_get(dirfd, name, APK_FI_NOFOLLOW, &fi, &db->atoms) < 0) return 0; memcpy(&atctx->path[atctx->pathlen], bent.ptr, bent.len); atctx->pathlen += bent.len; |