diff options
author | Ariadne Conill <ariadne@dereferenced.org> | 2021-12-13 12:19:05 -0600 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2021-12-29 20:14:41 +0200 |
commit | 03a5e6d9b9978c4e2fc6b904da379407ab9452bf (patch) | |
tree | 22ccf181eb0e474a6ad6657ad52b1cc2bc06dff5 /src/io.c | |
parent | 9d07d07fe4f663f7ebb5ec6a7ef5d2b1345bcea7 (diff) | |
download | apk-tools-03a5e6d9b9978c4e2fc6b904da379407ab9452bf.tar.gz apk-tools-03a5e6d9b9978c4e2fc6b904da379407ab9452bf.tar.bz2 apk-tools-03a5e6d9b9978c4e2fc6b904da379407ab9452bf.tar.xz apk-tools-03a5e6d9b9978c4e2fc6b904da379407ab9452bf.zip |
io: use opendirectory for UID/GID lookups on macOS
macOS has no concept of a chroot-specific UID/GID database, as the database is actually
LDAP.
ref #10794
Diffstat (limited to 'src/io.c')
-rw-r--r-- | src/io.c | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -1187,8 +1187,11 @@ static void idcache_load_users(int root_fd, struct apk_id_hash *idh) do { #ifdef HAVE_FGETPWENT_R fgetpwent_r(in, &pwent, buf, sizeof(buf), &pwd); -#else +#elif !defined(__APPLE__) pwd = fgetpwent(in); +#else +# warning macOS does not support nested /etc/passwd databases, using system one. + pwd = getpwent(); #endif if (!pwd) break; idcache_add(idh, APK_BLOB_STR(pwd->pw_name), pwd->pw_uid); @@ -1217,8 +1220,11 @@ static void idcache_load_groups(int root_fd, struct apk_id_hash *idh) do { #ifdef HAVE_FGETGRENT_R fgetgrent_r(in, &grent, buf, sizeof(buf), &grp); -#else +#elif !defined(__APPLE__) grp = fgetgrent(in); +#else +# warning macOS does not support nested /etc/group databases, using system one. + grp = getgrent(); #endif if (!grp) break; idcache_add(idh, APK_BLOB_STR(grp->gr_name), grp->gr_gid); |