summaryrefslogtreecommitdiffstats
path: root/usr.bin
diff options
context:
space:
mode:
authorache <ache@FreeBSD.org>2002-08-12 10:49:01 +0000
committerache <ache@FreeBSD.org>2002-08-12 10:49:01 +0000
commit3ad9cb58210495a97bc7065237d7f6781e76ea10 (patch)
tree968ded18fda4f477605464998ee34025fda4c7f9 /usr.bin
parent734de6403924cbb479826bf1b4f1bd97572ac1f3 (diff)
downloadFreeBSD-src-3ad9cb58210495a97bc7065237d7f6781e76ea10.zip
FreeBSD-src-3ad9cb58210495a97bc7065237d7f6781e76ea10.tar.gz
Fix su job control (recently introduced for PAM cleanup purposes) to not
kill login shell on either "suspend/fg" or "stop $$/fg" for tcsh. Since this bug occurse on -stable too, it is not kernel threads bug. Submitted by: David Xu <bsddiy@yahoo.com>
Diffstat (limited to 'usr.bin')
-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 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;
}
OpenPOWER on IntegriCloud