mirror of
https://git.proxmox.com/git/mirror_frr
synced 2025-08-08 01:47:29 +00:00
lib: don't print 2 backtraces for crashes
abort() raises SIGABRT, which would confusingly cause a 2nd backtrace to be printed after the first one... Signed-off-by: David Lamparter <equinox@diac24.net>
This commit is contained in:
parent
79ec61be27
commit
5be4799dc5
@ -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.
|
/* make sure we don't hang in here. default for SIGALRM is terminate.
|
||||||
* - if we're in backtrace for more than a second, abort. */
|
* - if we're in backtrace for more than a second, abort. */
|
||||||
struct sigaction sa_default = {.sa_handler = SIG_DFL};
|
struct sigaction sa_default = {.sa_handler = SIG_DFL};
|
||||||
|
|
||||||
sigaction(SIGALRM, &sa_default, NULL);
|
sigaction(SIGALRM, &sa_default, NULL);
|
||||||
|
sigaction(signo, &sa_default, NULL);
|
||||||
|
|
||||||
sigset_t sigset;
|
sigset_t sigset;
|
||||||
|
|
||||||
sigemptyset(&sigset);
|
sigemptyset(&sigset);
|
||||||
sigaddset(&sigset, SIGALRM);
|
sigaddset(&sigset, SIGALRM);
|
||||||
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
sigprocmask(SIG_UNBLOCK, &sigset, NULL);
|
||||||
@ -252,7 +255,16 @@ core_handler(int signo, siginfo_t *siginfo, void *context)
|
|||||||
log_memstats(stderr, "core_handler");
|
log_memstats(stderr, "core_handler");
|
||||||
|
|
||||||
zlog_tls_buffer_fini();
|
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)
|
static void trap_default_signals(void)
|
||||||
|
Loading…
Reference in New Issue
Block a user