rv = setgid(gid); if (debug) log_d("set_uids: setgid(%d) = %d", gid, rv); if (rv == -1) {
if (setgid(gid) == -1) {
static int set_uids(uid_t uid, gid_t gid){	int rv;	if (uid < 100) {		log_d("refusing to set uid to %d", uid);		return -1;	}	rv = setgroups(0, &gid);	if (debug)		log_d("set_uids: setgroups(0, [%d]) = %d", gid, rv);	if (rv == -1) {		lerror("setgroups");		return -1;	}	rv = setgid(gid);	if (debug)		log_d("set_uids: setgid(%d) = %d", gid, rv);	if (rv == -1) {		lerror("setgid");		return -1;	}	rv = setuid(uid);	if (debug)		log_d("set_uids: setuid(%d) = %d", uid, rv);	if (rv == -1) {		lerror("setuid");		return -1;	}	log_d("set_uids: uid set to %d, gid set to %d", uid, gid);	return 0;}