summaryrefslogtreecommitdiff
path: root/src/keyboard.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2014-05-29 21:12:08 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2014-05-29 21:12:08 -0700
commit8cf1e6e67926683e38809adced986d255124afd5 (patch)
tree778900c1d56daa5ffebf44e14c51d0f6a9410a40 /src/keyboard.c
parentacc16b66ffe8e3b0f3568c5ae2e3bf0dff2bc2fa (diff)
downloademacs-8cf1e6e67926683e38809adced986d255124afd5.tar.gz
Don't let SIGINT handling block SIGCHLD indefinitely.
* atimer.c (block_atimers): * callproc.c (block_child_signal): Block SIGINT too; otherwise, its handler might now unblock signals that it shouldn't. * keyboard.c (read_char): Clear signal mask, since we may be in a SIGINT handler, and many signals may be masked. * keyboard.c (handle_interrupt): * sysdep.c (handle_arith_signal): Clear signal mask instead of just unblocking the signal that was received, since several signals may be blocked at this point. Fixes: debbugs:17561
Diffstat (limited to 'src/keyboard.c')
-rw-r--r--src/keyboard.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/keyboard.c b/src/keyboard.c
index e92c86b7dbf..17bfc81b82f 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -2664,6 +2664,7 @@ read_char (int commandflag, Lisp_Object map,
/* We must have saved the outer value of getcjmp here,
so restore it now. */
restore_getcjmp (save_jump);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
unbind_to (jmpcount, Qnil);
XSETINT (c, quit_char);
internal_last_event_frame = selected_frame;
@@ -10323,9 +10324,6 @@ static void
handle_interrupt (bool in_signal_handler)
{
char c;
- sigset_t blocked;
- sigemptyset (&blocked);
- sigaddset (&blocked, SIGINT);
cancel_echoing ();
@@ -10337,6 +10335,9 @@ handle_interrupt (bool in_signal_handler)
/* If SIGINT isn't blocked, don't let us be interrupted by
a SIGINT. It might be harmful due to non-reentrancy
in I/O functions. */
+ sigset_t blocked;
+ sigemptyset (&blocked);
+ sigaddset (&blocked, SIGINT);
pthread_sigmask (SIG_BLOCK, &blocked, 0);
}
@@ -10421,7 +10422,7 @@ handle_interrupt (bool in_signal_handler)
struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
immediate_quit = 0;
- pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
saved = gl_state;
GCPRO4 (saved.object, saved.global_code,
saved.current_syntax_table, saved.old_prop);
@@ -10442,7 +10443,7 @@ handle_interrupt (bool in_signal_handler)
}
}
- pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
/* TODO: The longjmp in this call throws the NS event loop integration off,
and it seems to do fine without this. Probably some attention