From 19419f1a88285a0dee53bdf49201c4d3d4cbf19f Mon Sep 17 00:00:00 2001 From: Timo Teräs Date: Fri, 8 Oct 2010 15:36:54 +0300 Subject: 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. --- src/package.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/package.c') 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); -- cgit v1.2.3-60-g2f50