diff --git a/src/core/crash-handler.c b/src/core/crash-handler.c index 561b7fc19c..fced3ccf5a 100644 --- a/src/core/crash-handler.c +++ b/src/core/crash-handler.c @@ -47,10 +47,11 @@ _noreturn_ static void crash(int sig, siginfo_t *siginfo, void *context) { * memory allocation is not async-signal-safe anyway — see signal-safety(7) for details —, and thus * is not permissible in signal handlers.) */ - if (getpid_cached() != 1) + if (getpid_cached() != 1) { /* Pass this on immediately, if this is not PID 1 */ - (void) raise(sig); - else if (!arg_dump_core) + if (rt_tgsigqueueinfo(getpid_cached(), gettid(), sig, siginfo) < 0) + (void) raise(sig); + } else if (!arg_dump_core) log_emergency("Caught <%s>, not dumping core.", signal_to_string(sig)); else { sa = (struct sigaction) { @@ -80,7 +81,8 @@ _noreturn_ static void crash(int sig, siginfo_t *siginfo, void *context) { /* Raise the signal again */ pid = raw_getpid(); - (void) kill(pid, sig); /* raise() would kill the parent */ + if (rt_tgsigqueueinfo(pid, gettid(), sig, siginfo) < 0) + (void) kill(pid, sig); /* raise() would kill the parent */ assert_not_reached(); _exit(EXIT_EXCEPTION);