diff options
author | luoqi <luoqi@FreeBSD.org> | 1999-05-14 20:44:20 +0000 |
---|---|---|
committer | luoqi <luoqi@FreeBSD.org> | 1999-05-14 20:44:20 +0000 |
commit | 61a6d052eb99e886ce2c07909566a076b872523d (patch) | |
tree | d9538a36b8c0f0fe4e292b75276599f6a7ecd4cf | |
parent | 6f6fbfa99e3c73fa5933c9c958046b4c87f59fd9 (diff) | |
download | FreeBSD-src-61a6d052eb99e886ce2c07909566a076b872523d.zip FreeBSD-src-61a6d052eb99e886ce2c07909566a076b872523d.tar.gz |
Ignore some ioctls on the master until the slave is open.
-rw-r--r-- | sys/kern/tty_pty.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index c7c0313..5cdb711 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -31,7 +31,7 @@ * SUCH DAMAGE. * * @(#)tty_pty.c 8.4 (Berkeley) 2/20/95 - * $Id: tty_pty.c,v 1.56 1999/04/27 11:16:19 phk Exp $ + * $Id: tty_pty.c,v 1.57 1999/05/08 06:39:43 phk Exp $ */ /* @@ -674,8 +674,7 @@ ptyioctl(dev, cmd, data, flag, p) tp->t_lflag &= ~EXTPROC; } return(0); - } else - if (devsw(dev)->d_open == ptcopen) + } else if (devsw(dev)->d_open == ptcopen) { switch (cmd) { case TIOCGPGRP: @@ -711,7 +710,16 @@ ptyioctl(dev, cmd, data, flag, p) pti->pt_flags &= ~PF_REMOTE; ttyflush(tp, FREAD|FWRITE); return (0); + } + + /* + * The rest of the ioctls shouldn't be called until + * the slave is open. (Should we return an error?) + */ + if ((tp->t_state & TS_ISOPEN) == 0) + return (0); + switch (cmd) { #ifdef COMPAT_43 case TIOCSETP: case TIOCSETN: @@ -735,6 +743,7 @@ ptyioctl(dev, cmd, data, flag, p) ttyinfo(tp); return(0); } + } error = (*linesw[tp->t_line].l_ioctl)(tp, cmd, data, flag, p); if (error == ENOIOCTL) error = ttioctl(tp, cmd, data, flag); |