Daemon: simplify nested "if"

This commit is contained in:
Max Kellermann 2013-12-29 13:56:50 +01:00
parent 0b1ad27ba8
commit 20ffedc745

View File

@ -106,11 +106,10 @@ daemonize_set_user(void)
return;
/* set gid */
if (user_gid != (gid_t)-1 && user_gid != getgid()) {
if (setgid(user_gid) == -1) {
FormatFatalSystemError("Failed to set group %d",
(int)user_gid);
}
if (user_gid != (gid_t)-1 && user_gid != getgid() &&
setgid(user_gid) == -1) {
FormatFatalSystemError("Failed to set group %d",
(int)user_gid);
}
#ifdef _BSD_SOURCE