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
This commit is contained in:
David Xu 2003-11-03 23:54:55 +00:00
parent 8fd6ac3afa
commit bcf123b3f6
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=122013

View File

@ -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);