diff options
author | bde <bde@FreeBSD.org> | 1996-11-29 15:50:56 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-11-29 15:50:56 +0000 |
commit | 99d0d4f1a0e175ec3d3b69ab9a5ed3da05e711b8 (patch) | |
tree | 4e35b91657a21095594981f33f6786b8b5f941fd /sys/kern/tty.c | |
parent | 414e2c732fa1fc1f67f60f1f2b2e579665db8552 (diff) | |
download | FreeBSD-src-99d0d4f1a0e175ec3d3b69ab9a5ed3da05e711b8.zip FreeBSD-src-99d0d4f1a0e175ec3d3b69ab9a5ed3da05e711b8.tar.gz |
Fixed bugs handling (background) orphaned process groups. tty
writes and tty ioctls by processes in such groups must return
-1/EIO, but they were allowed. tty reads were handled correctly.
Found by: NIST PCTS
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r-- | sys/kern/tty.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index 0da2fca..62d5e79 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)tty.c 8.8 (Berkeley) 1/21/94 - * $Id: tty.c,v 1.85 1996/11/29 15:06:09 bde Exp $ + * $Id: tty.c,v 1.86 1996/11/29 15:23:42 bde Exp $ */ /*- @@ -738,10 +738,12 @@ ttioctl(tp, cmd, data, flag) case TIOCSETP: case TIOCSLTC: #endif - while (isbackground(curproc, tp) && - p->p_pgrp->pg_jobc && (p->p_flag & P_PPWAIT) == 0 && + while (isbackground(p, tp) && + (p->p_flag & P_PPWAIT) == 0 && (p->p_sigignore & sigmask(SIGTTOU)) == 0 && (p->p_sigmask & sigmask(SIGTTOU)) == 0) { + if (p->p_pgrp->pg_jobc == 0) + return (EIO); pgsignal(p->p_pgrp, SIGTTOU, 1); error = ttysleep(tp, &lbolt, TTOPRI | PCATCH, "ttybg1", 0); @@ -1768,8 +1770,11 @@ loop: if (isbackground(p, tp) && ISSET(tp->t_lflag, TOSTOP) && (p->p_flag & P_PPWAIT) == 0 && (p->p_sigignore & sigmask(SIGTTOU)) == 0 && - (p->p_sigmask & sigmask(SIGTTOU)) == 0 && - p->p_pgrp->pg_jobc) { + (p->p_sigmask & sigmask(SIGTTOU)) == 0) { + if (p->p_pgrp->pg_jobc == 0) { + error = EIO; + goto out; + } pgsignal(p->p_pgrp, SIGTTOU, 1); error = ttysleep(tp, &lbolt, TTIPRI | PCATCH, "ttybg4", 0); if (error) |