- if (g != (gid_t)-1) {
- if (setgid(g) || (getuid() == 0 && setgroups(1, &g))) {
- die(EXIT_FAILURE, "couldn't setgid to %u: %s",
- (unsigned)g, strerror(errno));
- }
- }
- if (u != (uid_t)-1) {
- if (setuid(u)) {
- die(EXIT_FAILURE, "couldn't setuid to %u: %s",
- (unsigned)u, strerror(errno));
- }
- }
+ ps_split(f & f_daemon);
+ a_init(csock, u, g, csockmode);
+ u_setugid(u, g);