summaryrefslogtreecommitdiffstats
path: root/usr.bin/su
diff options
context:
space:
mode:
authordavidxu <davidxu@FreeBSD.org>2003-11-03 23:54:55 +0000
committerdavidxu <davidxu@FreeBSD.org>2003-11-03 23:54:55 +0000
commit8792262eee4455c710d6cb7401cee1cf414e9746 (patch)
tree95c5889a6fc8a80e119ae5a276a7c760b920e30d /usr.bin/su
parentcf6dec8a88e37f487b395acc3a935fc94499d78f (diff)
downloadFreeBSD-src-8792262eee4455c710d6cb7401cee1cf414e9746.zip
FreeBSD-src-8792262eee4455c710d6cb7401cee1cf414e9746.tar.gz
It seems when su executes in a shell scripts, there is a timing race,
sometimes, su will receive a SIGTTOU when parent su tries to set child su's process group as foreground group, and su will be stopped unexpectly, ignoring SIGTTOU fixes the problem. Noticed by: fjoe
Diffstat (limited to 'usr.bin/su')
-rw-r--r--usr.bin/su/su.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index dae818f..8eac299 100644
--- a/usr.bin/su/su.c
+++ b/usr.bin/su/su.c
@@ -359,6 +359,8 @@ main(int argc, char *argv[])
child_pid = fork();
switch (child_pid) {
default:
+ sa.sa_handler = SIG_IGN;
+ sigaction(SIGTTOU, &sa, NULL);
close(fds[0]);
setpgid(child_pid, child_pid);
tcsetpgrp(1, child_pid);
OpenPOWER on IntegriCloud