From a999c7b5e79ca3fba37e32182bac8236bd7d0f4a Mon Sep 17 00:00:00 2001 From: Marius Halden Date: Sat, 28 Nov 2015 00:48:24 +0100 Subject: Clean up some error handling --- scan.c | 21 ++++++++------------- 1 file 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; -- cgit v1.2.3