ensure no signals are blocked when started

Fixes #3964
This commit is contained in:
Kurtis Rader 2017-05-02 20:55:41 -07:00
parent d3cfab1391
commit 107127afb7
3 changed files with 11 additions and 1 deletions

View file

@ -324,7 +324,7 @@ int main(int argc, char **argv) {
program_name = L"fish";
set_main_thread();
setup_fork_guards();
signal_unblock_all();
setlocale(LC_ALL, "");
fish_setlocale();

View file

@ -387,6 +387,13 @@ void signal_block(bool force) {
// debug( 0, L"signal block level increased to %d", block_count );
}
/// Ensure we did not inherit any blocked signals. See issue #3964.
void signal_unblock_all() {
sigset_t iset;
sigemptyset(&iset);
sigprocmask(SIG_SETMASK, &iset, NULL);
}
void signal_unblock(bool force) {
if (!force && ignore_signal_block) return;

View file

@ -26,6 +26,9 @@ void signal_set_handlers();
/// default action (SIG_DFL) will be set
void signal_handle(int sig, int do_handle);
/// Ensure we did not inherit any blocked signals. See issue #3964.
void signal_unblock_all();
/// Block all signals.
void signal_block(bool force = false);