daemon: simplify if/else chain

Reviewed by:	kevans
Pull Request:	https://github.com/freebsd/freebsd-src/pull/672
This commit is contained in:
Ihor Antonov 2023-03-02 23:17:02 -06:00 committed by Kyle Evans
parent bc43a9a715
commit cd1e6e70d0

View File

@ -452,22 +452,16 @@ main(int argc, char *argv[])
*/
if (child_gone && child_eof) {
break;
} else if (terminate) {
}
if (terminate) {
goto exit;
} else if (!child_eof) {
if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) {
warn("sigprocmask");
goto exit;
}
child_eof = !listen_child(pfd[0], &logparams);
if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) {
warn("sigprocmask");
goto exit;
}
} else {
}
if (child_eof) {
if (sigprocmask(SIG_BLOCK, &mask_susp, NULL)) {
warn("sigprocmask");
goto exit;
goto exit;
}
while (!terminate && !child_gone)
sigsuspend(&mask_orig);
@ -475,7 +469,21 @@ main(int argc, char *argv[])
warn("sigprocmask");
goto exit;
}
continue;
}
if (sigprocmask(SIG_BLOCK, &mask_read, NULL)) {
warn("sigprocmask");
goto exit;
}
child_eof = !listen_child(pfd[0], &logparams);
if (sigprocmask(SIG_UNBLOCK, &mask_read, NULL)) {
warn("sigprocmask");
goto exit;
}
}
if (restart && !terminate) {
daemon_sleep(restart, 0);