Skip to content

Commit 809fe79

Browse files
committed
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.
1 parent 718b890 commit 809fe79

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

src/signal_handling.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,17 @@ int setup_parent_signals() {
3434
}
3535

3636
int setup_child_signals() {
37-
int result;
3837
struct sigaction s;
3938
s.sa_handler = SIG_DFL;
4039
sigemptyset(&s.sa_mask);
4140
s.sa_flags = SA_RESTART;
4241

43-
if ((result = sigaction(SIGINT, &s, NULL)) < 0) {
44-
perror("Error in setting action for SIGINT");
45-
return result;
46-
}
47-
48-
if ((result = sigaction(SIGTSTP, &s, NULL)) < 0) {
49-
perror("Error in setting action for SIGTSTP");
50-
return result;
51-
}
42+
exit_on_error(sigaction(SIGINT, &s, NULL), "Error in setting action for SIGINT");
43+
exit_on_error(sigaction(SIGTSTP, &s, NULL), "Error in setting action for SIGTSTP");
44+
exit_on_error(sigaction(SIGTTIN, &s, NULL), "Error in setting action for SIGTTIN");
45+
/* exit_on_error(sigaction(SIGTTOU, &s, NULL), "Error in setting action for SIGTTOU"); */
46+
exit_on_error(sigaction(SIGCHLD, &s, NULL), "Error in setting action for SIGCHLD");
47+
exit_on_error(sigaction(SIGQUIT, &s, NULL), "Error in setting action for SIGQUIT");
5248

5349
return 0;
5450
}

0 commit comments

Comments
 (0)