user-util: sysconf_ngroups_max

This hides the iffy interface of sysconf(_SC_NGROUPS_MAX) to simplify
the calllers.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-07-02 17:19:18 +02:00
parent aac88fd8ab
commit 2c01b4895e
6 changed files with 23 additions and 14 deletions
+1 -3
View File
@@ -175,12 +175,10 @@ TEST(getpeercred_getpeergroups) {
assert_se(fully_set_uid_gid(test_uid, test_gid, test_gids, n_test_gids) >= 0);
} else {
long ngroups_max;
test_uid = getuid();
test_gid = getgid();
ngroups_max = sysconf(_SC_NGROUPS_MAX);
int ngroups_max = sysconf_ngroups_max();
assert_se(ngroups_max > 0);
test_gids = newa(gid_t, ngroups_max);