Skip to content

Commit

Permalink
Restore default action for all ignored signals except SIGTTOU.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
indradhanush committed Jun 19, 2017
1 parent 718b890 commit 809fe79
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/signal_handling.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 809fe79

Please sign in to comment.