summaryrefslogtreecommitdiffstats
path: root/main/apk-tools/0002-db-fix-the-previous-commit.patch
diff options
context:
space:
mode:
Diffstat (limited to 'main/apk-tools/0002-db-fix-the-previous-commit.patch')
-rw-r--r--main/apk-tools/0002-db-fix-the-previous-commit.patch50
1 files changed, 50 insertions, 0 deletions
diff --git a/main/apk-tools/0002-db-fix-the-previous-commit.patch b/main/apk-tools/0002-db-fix-the-previous-commit.patch
new file mode 100644
index 000000000..48f38ba07
--- /dev/null
+++ b/main/apk-tools/0002-db-fix-the-previous-commit.patch
@@ -0,0 +1,50 @@
+From 6398d338c6441f3b967a2633bbc9df4709bcb258 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Fri, 8 Oct 2010 16:09:03 +0300
+Subject: [PATCH 2/2] db: fix the previous commit
+
+id cache needs to be initialized early. and group database filename
+is surprisingly 'group'.
+---
+ src/database.c | 4 ++--
+ src/io.c | 2 +-
+ 2 files changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/database.c b/src/database.c
+index f0b8cb6..e22289a 100644
+--- a/src/database.c
++++ b/src/database.c
+@@ -1079,6 +1079,8 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+ S_ISDIR(st.st_mode) && major(st.st_dev) != 0)
+ db->cache_dir = apk_linked_cache_dir;
+
++ apk_id_cache_init(&db->id_cache, db->root_fd);
++
+ if (dbopts->open_flags & APK_OPENF_WRITE) {
+ db->lock_fd = openat(db->root_fd, "var/lib/apk/lock",
+ O_CREAT | O_RDWR | O_CLOEXEC, 0400);
+@@ -1177,8 +1179,6 @@ int apk_db_open(struct apk_database *db, struct apk_db_options *dbopts)
+ goto ret_r;
+ }
+
+- apk_id_cache_init(&db->id_cache, db->root_fd);
+-
+ return rr;
+
+ ret_errno:
+diff --git a/src/io.c b/src/io.c
+index 38bc4e6..0f09403 100644
+--- a/src/io.c
++++ b/src/io.c
+@@ -838,7 +838,7 @@ uid_t apk_resolve_gid(struct apk_id_cache *idc, const char *groupname, uid_t def
+ ci->genid = idc->genid;
+ ci->gid = -1;
+
+- in = fdopen(openat(idc->root_fd, "etc/passwd", O_RDONLY|O_CLOEXEC), "r");
++ in = fdopen(openat(idc->root_fd, "etc/group", O_RDONLY|O_CLOEXEC), "r");
+ if (in != NULL) {
+ do {
+ fgetgrent_r(in, &grent, buf, sizeof(buf), &grp);
+--
+1.7.3.1
+