Not calling fatal_signal_init() means that the signal handlers don't get
registered, so the process won't clean up on fatal signals. Furthermore,
signal_fds[0] is then 0, which means that fatal-signal_wait() waits on
stdin, so if you are testing a program interactively and accidentally type
something on stdin then that program's CPU usage jumps to 100%.
Since poll_block() calls fatal_signal_wait() this seems like the most
reliable solution.
void
fatal_signal_run(void)
{
- int sig_nr = stored_sig_nr;
+ int sig_nr;
+ fatal_signal_init();
+
+ sig_nr = stored_sig_nr;
if (sig_nr != SIG_ATOMIC_MAX) {
call_hooks(sig_nr);
void
fatal_signal_wait(void)
{
+ fatal_signal_init();
poll_fd_wait(signal_fds[0], POLLIN);
}