diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/su/su.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c index 6348099..33905a9 100644 --- a/usr.bin/su/su.c +++ b/usr.bin/su/su.c @@ -329,10 +329,13 @@ main(int argc, char *argv[]) default: while ((ret_pid = waitpid(child_pid, &statusp, WUNTRACED)) != -1) { if (WIFSTOPPED(statusp)) { - child_pgrp = tcgetpgrp(1); kill(getpid(), SIGSTOP); - tcsetpgrp(1, child_pgrp); - kill(child_pid, SIGCONT); + child_pgrp = getpgid(child_pid); + if (tcgetpgrp(1) == getpgrp()) + { + tcsetpgrp(1, child_pgrp); + kill(child_pid, SIGCONT); + } statusp = 1; continue; } |