diff options
author | Max Kellermann <max@duempel.org> | 2013-12-29 13:56:50 +0100 |
---|---|---|
committer | Max Kellermann <max@duempel.org> | 2013-12-29 13:57:12 +0100 |
commit | 20ffedc745f8360aeed59479d77601cf6cf7cc03 (patch) | |
tree | 79d0a5fd942af54ceea842a7b4fa8ed104982fe9 | |
parent | 0b1ad27ba8ecb8799e2a34ecad9206619cb8d14e (diff) |
Daemon: simplify nested "if"
-rw-r--r-- | src/Daemon.cxx | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Daemon.cxx b/src/Daemon.cxx index 088e7926d..1623cca24 100644 --- a/src/Daemon.cxx +++ b/src/Daemon.cxx @@ -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 |