diff options
author | paco <paco@voltanet.io> | 2018-06-18 17:25:20 +0200 |
---|---|---|
committer | paco <paco@voltanet.io> | 2018-06-18 19:40:39 +0200 |
commit | 0e8d7233e38357457ef015bc0d1f4e3ee2a6b2ba (patch) | |
tree | 6dc6aaf7e4a5fbed3cac54bfcd8c30831dccaca0 /ldpd | |
parent | Merge pull request #2458 from pacovn/Coverity_1221437_Unchecked_return_value (diff) | |
download | frr-0e8d7233e38357457ef015bc0d1f4e3ee2a6b2ba.tar.xz frr-0e8d7233e38357457ef015bc0d1f4e3ee2a6b2ba.zip |
ldpd: redundant condition (cppcheck)
Signed-off-by: F. Aragon <paco@voltanet.io>
Diffstat (limited to 'ldpd')
-rw-r--r-- | ldpd/ldpd.c | 30 |
1 files changed, 23 insertions, 7 deletions
diff --git a/ldpd/ldpd.c b/ldpd/ldpd.c index 255febeb6..b265c98da 100644 --- a/ldpd/ldpd.c +++ b/ldpd/ldpd.c @@ -406,16 +406,32 @@ ldpd_shutdown(void) free(vty_conf); log_debug("waiting for children to terminate"); - do { + + while (true) { + /* Wait for child process. */ pid = wait(&status); if (pid == -1) { - if (errno != EINTR && errno != ECHILD) - fatal("wait"); - } else if (WIFSIGNALED(status)) + /* We got interrupted, try again. */ + if (errno == EINTR) + continue; + /* No more processes were found. */ + if (errno != ECHILD) + break; + + /* Unhandled errno condition. */ + fatal("wait"); + /* UNREACHABLE */ + } + + /* We found something, lets announce it. */ + if (WIFSIGNALED(status)) log_warnx("%s terminated; signal %d", - (pid == lde_pid) ? "label decision engine" : - "ldp engine", WTERMSIG(status)); - } while (pid != -1 || (pid == -1 && errno == EINTR)); + (pid == lde_pid ? "label decision engine" + : "ldp engine"), + WTERMSIG(status)); + + /* Repeat until there are no more child processes. */ + } free(iev_ldpe); free(iev_lde); |