aboutsummaryrefslogtreecommitdiffstats
path: root/src/term.c
diff options
context:
space:
mode:
authorPaul Eggert2014-03-25 07:43:26 -0700
committerPaul Eggert2014-03-25 07:43:26 -0700
commit1e952f0a7a1d0cc533438dcad37db08d8af6855f (patch)
tree423d42b20476efd08fa7c0e4b62756c1b09c8cdd /src/term.c
parent1edb4a2ec657c305880901e78317daf1990b5358 (diff)
downloademacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.tar.gz
emacs-1e952f0a7a1d0cc533438dcad37db08d8af6855f.zip
Handle sigmask better with nested signal handlers.
* atimer.c (sigmask_atimers): Remove. Remaining use rewritten to use body of this function. * atimer.c (block_atimers, unblock_atimers): * callproc.c (block_child_signal, unblock_child_signal): * sysdep.c (block_tty_out_signal, unblock_tty_out_signal): New arg OLDSET. All callers changed. * atimer.c (block_atimers, unblock_atimers): * callproc.c (block_child_signal, unblock_child_signal): * keyboard.c (handle_interrupt): * sound.c (vox_configure, vox_close): Restore the old signal mask rather than unilaterally clearing bits from the mask, in case a handler is running within another handler. All callers changed. * lisp.h, process.c, process.h, term.c: Adjust decls and callers to match new API. * sysdep.c (emacs_sigaction_init): Don't worry about masking SIGFPE; signal handlers aren't supposed to use floating point anyway. (handle_arith_signal): Unblock just SIGFPE rather than clearing mask. Fixes: debbugs:15561
Diffstat (limited to 'src/term.c')
-rw-r--r--src/term.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/term.c b/src/term.c
index 3bcbb70aff6..df5fc17a0c0 100644
--- a/src/term.c
+++ b/src/term.c
@@ -3944,9 +3944,10 @@ dissociate_if_controlling_tty (int fd)
3944 /* setsid failed, presumably because Emacs is already a process 3944 /* setsid failed, presumably because Emacs is already a process
3945 group leader. Fall back on the obsolescent way to dissociate 3945 group leader. Fall back on the obsolescent way to dissociate
3946 a controlling tty. */ 3946 a controlling tty. */
3947 block_tty_out_signal (); 3947 sigset_t oldset;
3948 block_tty_out_signal (&oldset);
3948 ioctl (fd, TIOCNOTTY, 0); 3949 ioctl (fd, TIOCNOTTY, 0);
3949 unblock_tty_out_signal (); 3950 unblock_tty_out_signal (&oldset);
3950#endif 3951#endif
3951 } 3952 }
3952} 3953}
@@ -3970,6 +3971,7 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
3970 int status; 3971 int status;
3971 struct tty_display_info *tty = NULL; 3972 struct tty_display_info *tty = NULL;
3972 struct terminal *terminal = NULL; 3973 struct terminal *terminal = NULL;
3974 sigset_t oldset;
3973 bool ctty = false; /* True if asked to open controlling tty. */ 3975 bool ctty = false; /* True if asked to open controlling tty. */
3974 3976
3975 if (!terminal_type) 3977 if (!terminal_type)
@@ -4059,11 +4061,11 @@ init_tty (const char *name, const char *terminal_type, bool must_succeed)
4059 4061
4060 /* On some systems, tgetent tries to access the controlling 4062 /* On some systems, tgetent tries to access the controlling
4061 terminal. */ 4063 terminal. */
4062 block_tty_out_signal (); 4064 block_tty_out_signal (&oldset);
4063 status = tgetent (tty->termcap_term_buffer, terminal_type); 4065 status = tgetent (tty->termcap_term_buffer, terminal_type);
4064 if (tty->termcap_term_buffer[TERMCAP_BUFFER_SIZE - 1]) 4066 if (tty->termcap_term_buffer[TERMCAP_BUFFER_SIZE - 1])
4065 emacs_abort (); 4067 emacs_abort ();
4066 unblock_tty_out_signal (); 4068 unblock_tty_out_signal (&oldset);
4067 4069
4068 if (status < 0) 4070 if (status < 0)
4069 { 4071 {