db: fix the previous commit
id cache needs to be initialized early. and group database filename is surprisingly 'group'.cute-signatures
parent
19419f1a88
commit
6398d338c6
|
@ -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:
|
||||
|
|
2
src/io.c
2
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);
|
||||
|
|
Loading…
Reference in New Issue