fatal_handler: grab ABRT as well

pull/138/head
nick black 5 years ago
parent e6d35978d4
commit 71a2660b57
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -108,12 +108,12 @@ typedef struct notcurses_options {
// By default, we hide the cursor if possible. This flag inhibits use of
// the civis capability, retaining the cursor.
bool retain_cursor;
// We typically install a signal handler for SIGINT and SIGQUIT that restores
// the screen, and then calls the old signal handler. Set this to inhibit
// registration of any signal handlers.
// We typically install a signal handler for SIG{INT, SEGV, ABRT, QUIT} that
// restores the screen, and then calls the old signal handler. Set to inhibit
// registration of these signal handlers.
bool no_quit_sighandlers;
// We typically install a signal handler for SIGWINCH that generates a resize
// event in the notcurses_getc() queue. Set this to inhibit the handler.
// event in the notcurses_getc() queue. Set to inhibit this handler.
bool no_winch_sighandler;
// If non-NULL, notcurses_render() will write each rendered frame to this
// FILE* in addition to outfp. This is used primarily for debugging.

@ -48,7 +48,7 @@ sigwinch_handler(int signo){
}
// this wildly unsafe handler will attempt to restore the screen upon
// reception of SIGINT, SIGSEGV, or SIGQUIT. godspeed you, black emperor!
// reception of SIG{INT, SEGV, ABRT, QUIT}. godspeed you, black emperor!
static void
fatal_handler(int signo){
notcurses* nc = atomic_load(&signal_nc);
@ -86,11 +86,14 @@ setup_signals(notcurses* nc, bool no_quit_sigs, bool no_winch_sig){
sa.sa_handler = fatal_handler;
sigaddset(&sa.sa_mask, SIGINT);
sigaddset(&sa.sa_mask, SIGQUIT);
sigaddset(&sa.sa_mask, SIGSEGV);
sigaddset(&sa.sa_mask, SIGABRT);
sa.sa_flags = SA_RESETHAND; // don't try twice
int ret = 0;
ret |= sigaction(SIGINT, &sa, &oldact);
ret |= sigaction(SIGQUIT, &sa, &oldact);
ret |= sigaction(SIGSEGV, &sa, &oldact);
ret |= sigaction(SIGABRT, &sa, &oldact);
if(ret){
atomic_store(&signal_nc, NULL);
fprintf(stderr, "Error installing fatal signal handlers (%s)\n",
@ -2155,14 +2158,19 @@ int ncvisual_stream(notcurses* nc, ncvisual* ncv, int* averr){
}
// if "retain_cursor" was set, we don't have these definitions FIXME
void notcurses_cursor_enable(struct notcurses* nc){
void notcurses_cursor_enable(notcurses* nc){
if(nc->cnorm){
term_emit("cnorm", nc->cnorm, nc->ttyfp, false);
}
}
void notcurses_cursor_disable(struct notcurses* nc){
void notcurses_cursor_disable(notcurses* nc){
if(nc->civis){
term_emit("civis", nc->civis, nc->ttyfp, false);
}
}
int notcurses_refresh(notcurses* nc){
// FIXME
return 0;
}

Loading…
Cancel
Save