From 809fe795d94c1de851efafb6aff0e39b87149e93 Mon Sep 17 00:00:00 2001 From: Indradhanush Gupta Date: Mon, 19 Jun 2017 17:00:55 -0400 Subject: [PATCH] Restore default action for all ignored signals except SIGTTOU. Restoring SIGTTOU hides output of a foreground process but shows output of a background process. This is something that is not very clear to me, thus has been ignored for now. This blog post sheds some light http://curiousthing.org/sigttin-sigttou-deep-dive-linux but I am not totally convinced that the problem is what it talks about. --- src/signal_handling.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/src/signal_handling.c b/src/signal_handling.c index b28d5a4..a135163 100644 --- a/src/signal_handling.c +++ b/src/signal_handling.c @@ -34,21 +34,17 @@ int setup_parent_signals() { } int setup_child_signals() { - int result; struct sigaction s; s.sa_handler = SIG_DFL; sigemptyset(&s.sa_mask); s.sa_flags = SA_RESTART; - if ((result = sigaction(SIGINT, &s, NULL)) < 0) { - perror("Error in setting action for SIGINT"); - return result; - } - - if ((result = sigaction(SIGTSTP, &s, NULL)) < 0) { - perror("Error in setting action for SIGTSTP"); - return result; - } + exit_on_error(sigaction(SIGINT, &s, NULL), "Error in setting action for SIGINT"); + exit_on_error(sigaction(SIGTSTP, &s, NULL), "Error in setting action for SIGTSTP"); + exit_on_error(sigaction(SIGTTIN, &s, NULL), "Error in setting action for SIGTTIN"); + /* exit_on_error(sigaction(SIGTTOU, &s, NULL), "Error in setting action for SIGTTOU"); */ + exit_on_error(sigaction(SIGCHLD, &s, NULL), "Error in setting action for SIGCHLD"); + exit_on_error(sigaction(SIGQUIT, &s, NULL), "Error in setting action for SIGQUIT"); return 0; }