Skip to content

Commit b57e163

Browse files
committed
Added setgroups call because of POS36-C
1 parent abd21b4 commit b57e163

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/main.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -263,11 +263,14 @@ int main(int argc, char *argv[]) {
263263
dns_server_init(&dns_server, loop, opt.listen_addr, opt.listen_port,
264264
dns_server_cb, &app);
265265

266+
if (opt.gid != (uid_t)-1 && setgroups(1, &opt.gid)) {
267+
FLOG("Failed to set groups");
268+
}
266269
if (opt.gid != (uid_t)-1 && setgid(opt.gid)) {
267-
FLOG("Failed to set gid.");
270+
FLOG("Failed to set gid");
268271
}
269272
if (opt.uid != (uid_t)-1 && setuid(opt.uid)) {
270-
FLOG("Failed to set uid.");
273+
FLOG("Failed to set uid");
271274
}
272275

273276
if (opt.daemonize) {

0 commit comments

Comments
 (0)