summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/main.c')
-rw-r--r--src/core/main.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/core/main.c b/src/core/main.c
index 25f55fced2..bd7fc468b4 100644
--- a/src/core/main.c
+++ b/src/core/main.c
@@ -116,8 +116,10 @@ _noreturn_ static void crash(int sig) {
sa.sa_flags = SA_NOCLDSTOP|SA_RESTART;
assert_se(sigaction(SIGCHLD, &sa, NULL) == 0);
- if ((pid = fork()) < 0)
- log_error("Caught <%s>, cannot fork for core dump: %s", signal_to_string(sig), strerror(errno));
+ pid = fork();
+ if (pid < 0)
+ log_error("Caught <%s>, cannot fork for core dump: %s",
+ signal_to_string(sig), strerror(errno));
else if (pid == 0) {
struct rlimit rl;
@@ -147,12 +149,17 @@ _noreturn_ static void crash(int sig) {
int r;
/* Order things nicely. */
- if ((r = wait_for_terminate(pid, &status)) < 0)
- log_error("Caught <%s>, waitpid() failed: %s", signal_to_string(sig), strerror(-r));
+ r = wait_for_terminate(pid, &status);
+ if (r < 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));
+ 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);
+ log_error("Caught <%s>, dumped core as pid %lu.",
+ signal_to_string(sig),
+ (unsigned long) pid);
}
}
@@ -183,7 +190,8 @@ _noreturn_ static void crash(int sig) {
_exit(1);
}
- log_info("Successfully spawned crash shell as pid %lu.", (unsigned long) pid);
+ log_info("Successfully spawned crash shell as pid %lu.",
+ (unsigned long) pid);
}
log_info("Freezing execution.");