+2014-05-30 Paul Eggert <eggert@cs.ucla.edu>
+
+ Don't let SIGINT handling block SIGCHLD indefinitely (Bug#17561).
+ * 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.
+
2014-05-29 Eli Zaretskii <eliz@gnu.org>
* Makefile.in (TEMACS_POST_LINK): Remove target.
sigset_t blocked;
sigemptyset (&blocked);
sigaddset (&blocked, SIGALRM);
+ sigaddset (&blocked, SIGINT);
pthread_sigmask (SIG_BLOCK, &blocked, oldset);
}
static void
void
init_atimer (void)
{
- struct sigaction action;
#ifdef HAVE_ITIMERSPEC
struct sigevent sigev;
sigev.sigev_notify = SIGEV_SIGNAL;
alarm_timer_ok = timer_create (CLOCK_REALTIME, &sigev, &alarm_timer) == 0;
#endif
free_atimers = stopped_atimers = atimers = NULL;
- /* pending_signals is initialized in init_keyboard.*/
+
+ /* pending_signals is initialized in init_keyboard. */
+ struct sigaction action;
emacs_sigaction_init (&action, handle_alarm_signal);
sigaction (SIGALRM, &action, 0);
}
sigset_t blocked;
sigemptyset (&blocked);
sigaddset (&blocked, SIGCHLD);
+ sigaddset (&blocked, SIGINT);
pthread_sigmask (SIG_BLOCK, &blocked, oldset);
}
/* 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;
handle_interrupt (bool in_signal_handler)
{
char c;
- sigset_t blocked;
- sigemptyset (&blocked);
- sigaddset (&blocked, SIGINT);
cancel_echoing ();
/* 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);
}
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);
}
}
- 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
static _Noreturn void
handle_arith_signal (int sig)
{
- sigset_t blocked;
- sigemptyset (&blocked);
- sigaddset (&blocked, sig);
- pthread_sigmask (SIG_UNBLOCK, &blocked, 0);
+ pthread_sigmask (SIG_SETMASK, &empty_mask, 0);
xsignal0 (Qarith_error);
}