have nano handle SIGHUP/SIGTERM properly when it's suspended

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@1562 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
David Lawrence Ramsey 2003-09-29 07:21:11 +00:00
parent 2dd7ed14bc
commit 99bede34e7
2 changed files with 11 additions and 1 deletions

View File

@ -92,6 +92,10 @@ CVS code -
- Toggle MARK_ISSET() at the beginning of the function instead - Toggle MARK_ISSET() at the beginning of the function instead
of setting it in one place and unsetting it in another place. of setting it in one place and unsetting it in another place.
(David Benbennick) (David Benbennick)
do_suspend()
- Use handle_hupterm() to handle SIGHUP and SIGTERM so we can
properly deal with them while nano is suspended. (DLR; problem
found by David Benbennick)
abcd() abcd()
- Removed, as it's unneeded due to the low-level input overhaul. - Removed, as it's unneeded due to the low-level input overhaul.
(DLR) (DLR)

View File

@ -2852,6 +2852,12 @@ RETSIGTYPE do_suspend(int signal)
/* Restore the terminal settings for the disabled keys */ /* Restore the terminal settings for the disabled keys */
tcsetattr(0, TCSANOW, &oldterm); tcsetattr(0, TCSANOW, &oldterm);
/* Trap SIGHUP and SIGTERM so we can properly deal with them while
suspended */
act.sa_handler = handle_hupterm;
sigaction(SIGHUP, &act, NULL);
sigaction(SIGTERM, &act, NULL);
/* We used to re-enable the default SIG_DFL and raise SIGTSTP, but /* We used to re-enable the default SIG_DFL and raise SIGTSTP, but
then we could be (and were) interrupted in the middle of the call. then we could be (and were) interrupted in the middle of the call.
So we do it the mutt way instead */ So we do it the mutt way instead */
@ -2863,8 +2869,8 @@ RETSIGTYPE do_cont(int signal)
{ {
/* Now we just update the screen instead of having to reenable the /* Now we just update the screen instead of having to reenable the
SIGTSTP handler. */ SIGTSTP handler. */
doupdate(); doupdate();
/* The Hurd seems to need this, otherwise a ^Y after a ^Z will /* The Hurd seems to need this, otherwise a ^Y after a ^Z will
start suspending again. */ start suspending again. */
signal_init(); signal_init();