Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/kern Make sure repeated TIOCSCTTY doesn't corrupt sessio...



details:   https://anonhg.NetBSD.org/src/rev/9743e39033a5
branches:  trunk
changeset: 534318:9743e39033a5
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Jul 21 20:43:53 2002 +0000

description:
Make sure repeated TIOCSCTTY doesn't corrupt session hold count.
Fixes kern/17382 by David Laight.

diffstat:

 sys/kern/tty.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (29 lines):

diff -r 51a0d407e562 -r 9743e39033a5 sys/kern/tty.c
--- a/sys/kern/tty.c    Sun Jul 21 20:29:47 2002 +0000
+++ b/sys/kern/tty.c    Sun Jul 21 20:43:53 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.138 2002/05/02 13:38:57 enami Exp $  */
+/*     $NetBSD: tty.c,v 1.139 2002/07/21 20:43:53 jdolecek Exp $       */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -41,7 +41,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.138 2002/05/02 13:38:57 enami Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.139 2002/07/21 20:43:53 jdolecek Exp $");
 
 #include "opt_uconsole.h"
 
@@ -987,6 +987,10 @@
                    ((p->p_session->s_ttyvp || tp->t_session) &&
                    (tp->t_session != p->p_session)))
                        return (EPERM);
+
+               if (tp->t_session)
+                       SESSRELE(tp->t_session);
+
                SESSHOLD(p->p_session);
                tp->t_session = p->p_session;
                tp->t_pgrp = p->p_pgrp;



Home | Main Index | Thread Index | Old Index