summaryrefslogtreecommitdiff
path: root/src/core/main.c
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-24 19:45:16 -0400
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2013-03-31 14:36:12 -0400
commite62d8c3944745ed276e6d4f33153009860e5cfc5 (patch)
treee7f70ed3b80581017b6340723ab6f1d6b9c30bad /src/core/main.c
parent3c8bed4ee061f96acb4d70a591a9849bddd2a659 (diff)
Modernization
Use _cleanup_ and wrap lines to ~80 chars and such.
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.");