#include <err.h>
#include <time.h>
#include <signal.h>
+#include <sys/wait.h>
#include <nettle/sha.h>
status, (unsigned long)got);
continue;
}
- if (status
-
+ if (WIFEXITED(status)) {
+ int v = WEXITSTATUS(status);
+ if (v) warn("program failed with error exit status %d", v);
+ exit(status);
+ } else if (WIFSIGNALED(status)) {
+ int s = WTERMSIG(status);
+ err(status & 0xff, "program died due to fatal signal %s%s",
+ strsignal(s), WCOREDUMP(status) ? " (core dumped" : "");
+ } else {
+ err(127, "program failed with crazy wait status %#x", status);
+ }
+ }
+ exit(127);
+}
static void setup_handlers(void) {
struct sigaction sa;