From 605f11c8f23aa432b1ace122c34b3031c0ee1b5e Mon Sep 17 00:00:00 2001 From: David Greenman Date: Thu, 18 Aug 1994 03:53:38 +0000 Subject: [PATCH] Moved over my fix for vnode lossage when multiple TIOCSCTTY ioctls are done. This patch was extended to also include a suggested change by Kirk McKusick which allows the control tty to be reasigned to a different tty without losing a vnode. --- sys/kern/vfs_vnops.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 2b6429912f27..7229c33c4871 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)vfs_vnops.c 8.2 (Berkeley) 1/21/94 - * $Id$ + * $Id: vfs_vnops.c,v 1.3 1994/08/02 07:43:33 davidg Exp $ */ #include @@ -398,6 +398,15 @@ vn_ioctl(fp, com, data, p) case VBLK: error = VOP_IOCTL(vp, com, data, fp->f_flag, p->p_ucred, p); if (error == 0 && com == TIOCSCTTY) { + + /* Do nothing if reassigning same control tty */ + if (p->p_session->s_ttyvp == vp) + return (0); + + /* Get rid of reference to old control tty */ + if (p->p_session->s_ttyvp) + vrele(p->p_session->s_ttyvp); + p->p_session->s_ttyvp = vp; VREF(vp); }