do_suspend() - Added _POSIX_VDISABLE macro to fully ignore suspend keystroke. Eliminates the possibility that nano can be suspended when it's not supposed to be

git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@703 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
This commit is contained in:
Chris Allegretta 2001-06-30 04:09:09 +00:00
parent d173c15ce5
commit ac899e5f80
2 changed files with 17 additions and 0 deletions

View File

@ -118,6 +118,10 @@ Cvs code -
- Don't try to play with the handler inside the handler. Just
raise a SIGSTOP. We also now write the "use "fg"" message to
stdout instead of stderr.
- Added _POSIX_VDISABLE macro to fully ignore suspend keystroke.
Eliminates the possibility that nano can be suspended when
it's not supposed to be. Many many many thanks to Jordi and
Tom Lear for helping out finding and fixing this bug!
do_cont()
- Now just does a refresh call instead of playing with the SIGTSTP
handler.

13
nano.c
View File

@ -1740,6 +1740,9 @@ void handle_sigwinch(int s)
void signal_init(void)
{
#ifdef _POSIX_VDISABLE
struct termios term;
#endif
/* Trap SIGINT and SIGQUIT cuz we want them to do useful things. */
memset(&act, 0, sizeof(struct sigaction));
@ -1754,7 +1757,17 @@ void signal_init(void)
sigaction(SIGWINCH, &act, NULL);
if (!ISSET(SUSPEND)) {
/* Insane! */
#ifdef _POSIX_VDISABLE
tcgetattr(0, &term);
term.c_cc[VSUSP] = _POSIX_VDISABLE;
tcsetattr(0, TCSANOW, &term);
#else
act.sa_handler = SIG_IGN;
sigaction(SIGTSTP, &act, NULL);
#endif
} else {
/* if we don't do this, it seems other stuff interrupts the
suspend handler! Try using nano with mutt without this line */