chiark / gitweb /
core: explain why failing to set up the crash handler is not a real problem
authorLennart Poettering <lennart@poettering.net>
Tue, 27 Jan 2015 00:47:37 +0000 (01:47 +0100)
committerLennart Poettering <lennart@poettering.net>
Tue, 27 Jan 2015 00:49:09 +0000 (01:49 +0100)
http://lists.freedesktop.org/archives/systemd-devel/2015-January/027428.html

src/core/main.c

index e2e1399564afc8c0c01769a82644c33399dfcdd8..ce37c59e8155c713ded07cc5cc1a0e6846e24a0c 100644 (file)
@@ -224,12 +224,17 @@ noreturn static void crash(int sig) {
 }
 
 static void install_crash_handler(void) {
-        struct sigaction sa = {
+        static const struct sigaction sa = {
                 .sa_handler = crash,
-                .sa_flags = SA_NODEFER,
+                .sa_flags = SA_NODEFER, /* So that we can raise the signal again from the signal handler */
         };
+        int r;
 
-        sigaction_many(&sa, SIGNALS_CRASH_HANDLER, -1);
+        /* We ignore the return value here, since, we don't mind if we
+         * cannot set up a crash handler */
+        r = sigaction_many(&sa, SIGNALS_CRASH_HANDLER, -1);
+        if (r < 0)
+                log_debug_errno(r, "I had trouble setting up the crash handler, ignoring: %m");
 }
 
 static int console_setup(void) {