Skip to content
Snippets Groups Projects
Commit 8d6fb8b4 authored by Timo Teräs's avatar Timo Teräs
Browse files

abuild-sudo: fix determining number of groups

Musl _SC_NGROUPS_MAX is fixed at 32. The kernel can support more.
Query the kernel for number of groups needed.
parent 69d15d32
No related branches found
No related tags found
1 merge request!213abuild-sudo: fix determining number of groups
Pipeline #167178 passed
...@@ -62,7 +62,7 @@ void check_option(const char *opt) ...@@ -62,7 +62,7 @@ void check_option(const char *opt)
int is_in_group(gid_t group) int is_in_group(gid_t group)
{ {
int ngroups_max = sysconf(_SC_NGROUPS_MAX) + 1; int ngroups_max = getgroups(0, 0);
gid_t *buf = malloc(ngroups_max * sizeof(gid_t)); gid_t *buf = malloc(ngroups_max * sizeof(gid_t));
int ngroups; int ngroups;
int i; int i;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment