summaryrefslogtreecommitdiffstats
path: root/src/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/config.c')
-rw-r--r--src/config.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index f2a6dab..18ef34c 100644
--- a/src/config.c
+++ b/src/config.c
@@ -439,11 +439,17 @@ static void configure_user(void) {
if (getgrouplist(conf.user, conf.gid, NULL, &ngroups) < 0) {
/* the user has supplementary groups */
- conf.groups = fastd_new0_array(ngroups, gid_t);
- if (getgrouplist(conf.user, conf.gid, conf.groups, &ngroups) < 0)
+ GROUPLIST_TYPE groups[ngroups];
+
+ if (getgrouplist(conf.user, conf.gid, groups, &ngroups) < 0)
exit_errno("getgrouplist");
conf.n_groups = ngroups;
+ conf.groups = fastd_new_array(ngroups, gid_t);
+
+ int i;
+ for (i = 0; i < ngroups; i++)
+ conf.groups[i] = groups[i];
}
}
}