diff options
| author | Donald Sharp <sharpd@cumulusnetworks.com> | 2021-04-20 06:11:13 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-20 06:11:13 -0400 |
| commit | 117d216ba0cd27a3efa1973e12f73bd9cc4b4cfb (patch) | |
| tree | 6740f08439768af083e15bfe3ceafdb02526b4ef /lib/sigevent.c | |
| parent | 0433e60cb33e24039b28f541ada3141e503b03b9 (diff) | |
| parent | 4b4935bbc238186b07c365ccd32751af9f02921c (diff) | |
Merge pull request #8503 from opensourcerouting/one-backtrace-is-enough
lib: 640k backtraces should be enough for everybody
Diffstat (limited to 'lib/sigevent.c')
| -rw-r--r-- | lib/sigevent.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/sigevent.c b/lib/sigevent.c index 64cec1385d..be7297f264 100644 --- a/lib/sigevent.c +++ b/lib/sigevent.c @@ -237,9 +237,12 @@ core_handler(int signo, siginfo_t *siginfo, void *context) /* make sure we don't hang in here. default for SIGALRM is terminate. * - if we're in backtrace for more than a second, abort. */ struct sigaction sa_default = {.sa_handler = SIG_DFL}; + sigaction(SIGALRM, &sa_default, NULL); + sigaction(signo, &sa_default, NULL); sigset_t sigset; + sigemptyset(&sigset); sigaddset(&sigset, SIGALRM); sigprocmask(SIG_UNBLOCK, &sigset, NULL); @@ -252,7 +255,16 @@ core_handler(int signo, siginfo_t *siginfo, void *context) log_memstats(stderr, "core_handler"); zlog_tls_buffer_fini(); - abort(); + + /* give the kernel a chance to generate a coredump */ + sigaddset(&sigset, signo); + sigprocmask(SIG_UNBLOCK, &sigset, NULL); + raise(signo); + + /* only chance to end up here is if the default action for signo is + * something other than kill or coredump the process + */ + _exit(128 + signo); } static void trap_default_signals(void) |
