From: Chris Allegretta Date: Sat, 30 Jun 2001 04:09:09 +0000 (+0000) Subject: do_suspend() - Added _POSIX_VDISABLE macro to fully ignore suspend keystroke. Elimina... X-Git-Tag: v1.1.0~16 X-Git-Url: https://git.wh0rd.org/?a=commitdiff_plain;h=ac899e5f80ca5751a4a49eb1fdfe9b564b92dac9;p=nano.git 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 --- diff --git a/ChangeLog b/ChangeLog index 9479875b..9f8ab3c1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/nano.c b/nano.c index b78a7b32..a95a6ac4 100644 --- a/nano.c +++ b/nano.c @@ -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 */