summaryrefslogtreecommitdiffstats
path: root/src/package.c
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/package.c
parenta31948ae2640986b8a012b20e2a188ce0fea2cc2 (diff)
downloadapk-tools-19419f1a88285a0dee53bdf49201c4d3d4cbf19f.tar.bz2
apk-tools-19419f1a88285a0dee53bdf49201c4d3d4cbf19f.tar.xz
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/package.c')
-rw-r--r--src/package.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/package.c b/src/package.c
index 8f15e7a..df53d93 100644
--- a/src/package.c
+++ b/src/package.c
@@ -793,7 +793,7 @@ int apk_pkg_read(struct apk_database *db, const char *file,
ctx.pkg->size = fi.size;
tar = apk_bstream_gunzip_mpart(bs, apk_sign_ctx_mpart_cb, sctx);
- r = apk_tar_parse(tar, read_info_entry, &ctx, FALSE);
+ r = apk_tar_parse(tar, read_info_entry, &ctx, FALSE, &db->id_cache);
tar->close(tar);
if (r < 0 && r != -ECANCELED)
goto err;
@@ -856,7 +856,8 @@ int apk_ipkg_add_script(struct apk_installed_package *ipkg,
return 0;
}
-int apk_ipkg_run_script(struct apk_installed_package *ipkg, int root_fd,
+int apk_ipkg_run_script(struct apk_installed_package *ipkg,
+ struct apk_database *db,
unsigned int type, char **argv)
{
static char * const environment[] = {
@@ -865,7 +866,7 @@ int apk_ipkg_run_script(struct apk_installed_package *ipkg, int root_fd,
};
struct apk_package *pkg = ipkg->pkg;
char fn[PATH_MAX];
- int fd, status;
+ int fd, status, root_fd = db->root_fd;
pid_t pid;
if (type >= APK_SCRIPT_MAX)
@@ -911,7 +912,7 @@ int apk_ipkg_run_script(struct apk_installed_package *ipkg, int root_fd,
}
waitpid(pid, &status, 0);
unlinkat(root_fd, fn, 0);
- apk_id_cache_reset();
+ apk_id_cache_reset(&db->id_cache);
if (WIFEXITED(status))
return WEXITSTATUS(status);