summaryrefslogtreecommitdiff
path: root/src/apk_io.h
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2010-10-08 15:36:54 +0300
committerTimo Teräs <timo.teras@iki.fi>2010-10-08 15:36:54 +0300
commit19419f1a88285a0dee53bdf49201c4d3d4cbf19f (patch)
treef8221675060919509e2bef32d2fb5b68df05cddd /src/apk_io.h
parenta31948ae2640986b8a012b20e2a188ce0fea2cc2 (diff)
downloadapk-tools-19419f1a88285a0dee53bdf49201c4d3d4cbf19f.tar.gz
apk-tools-19419f1a88285a0dee53bdf49201c4d3d4cbf19f.tar.bz2
apk-tools-19419f1a88285a0dee53bdf49201c4d3d4cbf19f.tar.xz
apk-tools-19419f1a88285a0dee53bdf49201c4d3d4cbf19f.zip
io, db: id cache should be specific to database root, not system root
Otherwise we end up using wrong uid/gid mappings when doing install to alternate system root. Fixes #434.
Diffstat (limited to 'src/apk_io.h')
-rw-r--r--src/apk_io.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/apk_io.h b/src/apk_io.h
index 3a3abff..20051a6 100644
--- a/src/apk_io.h
+++ b/src/apk_io.h
@@ -15,6 +15,14 @@
#include "apk_defines.h"
#include "apk_blob.h"
+#include "apk_hash.h"
+
+struct apk_id_cache {
+ int root_fd;
+ unsigned int genid;
+ struct apk_hash uid_cache;
+ struct apk_hash gid_cache;
+};
struct apk_file_info {
char *name;
@@ -95,10 +103,10 @@ int apk_file_get_info(int atfd, const char *filename, unsigned int flags,
int apk_url_download(const char *url, int atfd, const char *file);
const char *apk_url_local_file(const char *url);
-void apk_id_cache_init(void);
-void apk_id_cache_free(void);
-void apk_id_cache_reset(void);
-uid_t apk_resolve_uid(const char *username, uid_t default_uid);
-uid_t apk_resolve_gid(const char *groupname, uid_t default_gid);
+void apk_id_cache_init(struct apk_id_cache *idc, int root_fd);
+void apk_id_cache_free(struct apk_id_cache *idc);
+void apk_id_cache_reset(struct apk_id_cache *idc);
+uid_t apk_resolve_uid(struct apk_id_cache *idc, const char *username, uid_t default_uid);
+uid_t apk_resolve_gid(struct apk_id_cache *idc, const char *groupname, uid_t default_gid);
#endif