top: at abnormal end allow core dumps (fix qualys bug)
A Qualys audit patch, represented in the commit below,
added the _exit() call to our abnormal signal handler.
Unfortunately, that disabled the associated core dump.
This patch restores expected behavior of those signals
whose default produces a core dump file + termination.
Reference(s):
commit e1f419737f
Signed-off-by: Jim Warner <james.warner@comcast.net>
This commit is contained in:
parent
12b6452135
commit
1d73eb567c
@ -430,18 +430,22 @@ static void error_exit (const char *str) {
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Catches all remaining signals not otherwise handled */
|
* Catches all remaining signals not otherwise handled */
|
||||||
|
static void sig_abexit (int sig) __attribute__((__noreturn__));
|
||||||
static void sig_abexit (int sig) {
|
static void sig_abexit (int sig) {
|
||||||
sigset_t ss;
|
sigset_t ss;
|
||||||
|
|
||||||
// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask, signal, raise
|
// POSIX.1-2004 async-signal-safe: sigfillset, sigprocmask, signal, sigemptyset, sigaddset, raise
|
||||||
sigfillset(&ss);
|
sigfillset(&ss);
|
||||||
sigprocmask(SIG_BLOCK, &ss, NULL);
|
sigprocmask(SIG_BLOCK, &ss, NULL);
|
||||||
at_eoj(); // restore tty in preparation for exit
|
at_eoj(); // restore tty in preparation for exit
|
||||||
fprintf(stderr, N_fmt(EXIT_signals_fmt)
|
fprintf(stderr, N_fmt(EXIT_signals_fmt)
|
||||||
, sig, signal_number_to_name(sig), Myname);
|
, sig, signal_number_to_name(sig), Myname);
|
||||||
signal(sig, SIG_DFL); // allow core dumps, if applicable
|
signal(sig, SIG_DFL); // allow core dumps, if applicable
|
||||||
|
sigemptyset(&ss);
|
||||||
|
sigaddset(&ss, sig);
|
||||||
|
sigprocmask(SIG_UNBLOCK, &ss, NULL);
|
||||||
raise(sig); // ( plus set proper return code )
|
raise(sig); // ( plus set proper return code )
|
||||||
_exit(sig | 0x80); // if default sig action is ignore
|
_exit(EXIT_FAILURE); // if default sig action is ignore
|
||||||
} // end: sig_abexit
|
} // end: sig_abexit
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user