aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/ash.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c
index 09e9ef605..408027305 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -4712,7 +4712,22 @@ freejob(struct job *jp)
4712static void 4712static void
4713xtcsetpgrp(int fd, pid_t pgrp) 4713xtcsetpgrp(int fd, pid_t pgrp)
4714{ 4714{
4715 if (tcsetpgrp(fd, pgrp)) 4715 int err;
4716
4717 sigblockall(NULL);
4718 err = tcsetpgrp(fd, pgrp);
4719 sigclearmask();
4720 // Unmasking signals would cause any arrived signal to trigger, so why?
4721 // Generally yes, but there are exceptions. Such as:
4722 // """
4723 // Attempts to use tcsetpgrp() from a process which is a member of
4724 // a background process group on a fd associated with its controlling
4725 // terminal shall cause the process group to be sent a SIGTTOU signal.
4726 // If the calling thread is blocking SIGTTOU signals or the process
4727 // is ignoring SIGTTOU signals, the process shall be allowed
4728 // to perform the operation, and no signal is sent."""
4729
4730 if (err)
4716 ash_msg_and_raise_perror("can't set tty process group"); 4731 ash_msg_and_raise_perror("can't set tty process group");
4717} 4732}
4718 4733