summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-09-15 14:48:59 +0200
committerLennart Poettering <lennart@poettering.net>2010-09-15 14:48:59 +0200
commit8e12a6aed3d99ac8c140cd56b560f5efeb1c4e1a (patch)
tree39f251b6aae53cbd767186f8efe3715270c220aa /src/main.c
parent2e78aa9988425d540a572535fa2e3d68ff519316 (diff)
util: use waitid() instead of waitpid() everywhere to avoid confusion due to SIGSTOP
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index dc561a9b8..e4f229e3f 100644
--- a/src/main.c
+++ b/src/main.c
@@ -119,12 +119,13 @@ _noreturn_ static void crash(int sig) {
_exit(1);
} else {
- int status;
+ siginfo_t status;
+ int r;
/* Order things nicely. */
- if (waitpid(pid, &status, 0) < 0)
- log_error("Caught <%s>, waitpid() failed: %s", signal_to_string(sig), strerror(errno));
- else if (!WCOREDUMP(status))
+ if ((r = wait_for_terminate(pid, &status)) < 0)
+ log_error("Caught <%s>, waitpid() failed: %s", signal_to_string(sig), strerror(-r));
+ else if (status.si_code != CLD_DUMPED)
log_error("Caught <%s>, core dump failed.", signal_to_string(sig));
else
log_error("Caught <%s>, dumped core as pid %lu.", signal_to_string(sig), (unsigned long) pid);