aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMarius Halden <marius.h@lden.org>2015-11-28 00:48:24 +0100
committerMarius Halden <marius.h@lden.org>2015-11-28 00:48:24 +0100
commita999c7b5e79ca3fba37e32182bac8236bd7d0f4a (patch)
tree36a3cb73419c9ec98a9cb33c332513351f202468
parent2dc7e9e6bd7f70fde6ea09bbb5372a11f90f698a (diff)
downloadsvcmon-a999c7b5e79ca3fba37e32182bac8236bd7d0f4a.tar.gz
svcmon-a999c7b5e79ca3fba37e32182bac8236bd7d0f4a.tar.bz2
svcmon-a999c7b5e79ca3fba37e32182bac8236bd7d0f4a.tar.xz
Clean up some error handling
-rw-r--r--scan.c21
1 files changed, 8 insertions, 13 deletions
diff --git a/scan.c b/scan.c
index b18ad60..8e92a68 100644
--- a/scan.c
+++ b/scan.c
@@ -229,15 +229,11 @@ reap_all()
sleep(1);
}
- if (r != -1)
- continue;
-
- if (errno == EINTR) {
- continue;
- } else if (errno == ECHILD) {
- break;
- } else {
- perror("wait()");
+ if (r == -1) {
+ if (errno == EINTR)
+ continue;
+ if (errno != ECHILD)
+ perror("waitpid()");
break;
}
}
@@ -256,10 +252,9 @@ try_wait()
if (p == -1) {
if (errno == EINTR) /* Impossible? */
continue;
- else if (errno == ECHILD) /* In case there are no children */
- break;
- else
- err(1, "waitpid()");
+ if (errno != ECHILD)
+ perror("waitpid()");
+ break;
}
r = 1;