diff options
author | 1996-08-01 14:17:20 +0000 | |
---|---|---|
committer | 1996-08-01 14:17:20 +0000 | |
commit | a8e57550b7c3a68c03e31fba43b83ccc78f4ebcd (patch) | |
tree | b04d01d0fcbfdfd34032db5d44b86d8f79b812ce | |
parent | Comment my recent change (diff) | |
download | wireguard-openbsd-a8e57550b7c3a68c03e31fba43b83ccc78f4ebcd.tar.xz wireguard-openbsd-a8e57550b7c3a68c03e31fba43b83ccc78f4ebcd.zip |
xconsole was broken after last patch (UCONSOLE zap).
-rw-r--r-- | sys/kern/tty.c | 31 |
1 files changed, 17 insertions, 14 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c index ffd5757a7e0..a40723b306a 100644 --- a/sys/kern/tty.c +++ b/sys/kern/tty.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tty.c,v 1.8 1996/07/31 18:34:36 deraadt Exp $ */ +/* $OpenBSD: tty.c,v 1.9 1996/08/01 14:17:20 mickey Exp $ */ /* $NetBSD: tty.c,v 1.68.4.2 1996/06/06 16:04:52 thorpej Exp $ */ /*- @@ -711,23 +711,26 @@ ttioctl(tp, cmd, data, flag, p) break; } case TIOCCONS: { /* become virtual console */ - struct nameidata nid; - - /* ensure user can open the real console */ - NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console", p); - error = namei(&nid); - if (error) - return (error); - error = VOP_ACCESS(nid.ni_vp, VREAD, p->p_ucred, p); - vrele(nid.ni_vp); - if (error) - return (error); - if (*(int *)data) { - if (constty && constty != tp && + struct nameidata nid; + + if (constty != NULL && constty != tp && ISSET(constty->t_state, TS_CARR_ON | TS_ISOPEN) == (TS_CARR_ON | TS_ISOPEN)) return (EBUSY); + + /* ensure user can open the real console */ + NDINIT(&nid, LOOKUP, FOLLOW, UIO_SYSSPACE, "/dev/console", p); + error = namei(&nid); + if (error) + return (error); + VOP_LOCK(nid.ni_vp); + error = VOP_ACCESS(nid.ni_vp, VREAD, p->p_ucred, p); + VOP_UNLOCK(nid.ni_vp); + vrele(nid.ni_vp); + if (error) + return (error); + constty = tp; } else if (tp == constty) constty = NULL; |