summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrey A. Chernov <ache@FreeBSD.org>2002-08-12 10:49:01 +0000
committerAndrey A. Chernov <ache@FreeBSD.org>2002-08-12 10:49:01 +0000
commit54c93e4f4d90644054088ca635208c2130176e00 (patch)
tree968ded18fda4f477605464998ee34025fda4c7f9
parentd8a0d0795b0c4743a4fcb6d7a40029e9a7a68c55 (diff)
Notes
-rw-r--r--usr.bin/su/su.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/usr.bin/su/su.c b/usr.bin/su/su.c
index 6348099c92c5..33905a983c29 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;
}