Skip to content

Commit

Permalink
own sigterm handler to deactivate xmouse extended protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
okbob committed Apr 22, 2021
1 parent a1dda9a commit e4656b2
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/pspg.c
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,9 @@ static struct sigaction old_sigsegv_handler;
*/
char pspg_errstr_buffer[PSPG_ERRSTR_BUFFER_SIZE];

/*
* Own signal handlers
*/
static void
SigintHandler(int sig_num)
{
Expand All @@ -175,6 +178,17 @@ SigintHandler(int sig_num)
handle_sigint = true;
}

static void
SigtermHandler(int sig_num)
{
UNUSED(sig_num);

signal(SIGTERM, SigtermHandler);

/* force own exit_ncurses routine */
exit(EXIT_FAILURE);
}

/* Custom SIGSEGV handler. */
void
SigsegvHandler (int sig)
Expand Down Expand Up @@ -2882,6 +2896,8 @@ main(int argc, char *argv[])
noatty = false;

signal(SIGINT, SigintHandler);
signal(SIGTERM, SigtermHandler);

atexit(exit_ncurses);

if (state.tty)
Expand Down Expand Up @@ -4018,7 +4034,7 @@ leaveok(stdscr, TRUE);
}
else if (command == cmd_Escape)
{
/* same like sigterm handling */
/* same like sigint handling */
if (!opts.no_sigint_search_reset &&
(*scrdesc.searchterm || *scrdesc.searchcolterm ||
scrdesc.selected_first_row != -1 ||
Expand Down

0 comments on commit e4656b2

Please sign in to comment.