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:
parent
8fd6ac3afa
commit
bcf123b3f6
@ -359,6 +359,8 @@ main(int argc, char *argv[])
|
|||||||
child_pid = fork();
|
child_pid = fork();
|
||||||
switch (child_pid) {
|
switch (child_pid) {
|
||||||
default:
|
default:
|
||||||
|
sa.sa_handler = SIG_IGN;
|
||||||
|
sigaction(SIGTTOU, &sa, NULL);
|
||||||
close(fds[0]);
|
close(fds[0]);
|
||||||
setpgid(child_pid, child_pid);
|
setpgid(child_pid, child_pid);
|
||||||
tcsetpgrp(1, child_pid);
|
tcsetpgrp(1, child_pid);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user