uucp dies if it cannot repeatedly set the same controlling tty
authorKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 16 Aug 1994 02:57:50 +0000 (18:57 -0800)
committerKirk McKusick <mckusick@ucbvax.Berkeley.EDU>
Tue, 16 Aug 1994 02:57:50 +0000 (18:57 -0800)
SCCS-vsn: sys/kern/tty.c 8.11

usr/src/sys/kern/tty.c

index 81e6964..e4264b9 100644 (file)
@@ -9,7 +9,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)tty.c       8.10 (Berkeley) %G%
+ *     @(#)tty.c       8.11 (Berkeley) %G%
  */
 
 #include <sys/param.h>
  */
 
 #include <sys/param.h>
@@ -701,8 +701,8 @@ ttioctl(tp, cmd, data, flag)
        case TIOCSCTTY:                 /* become controlling tty */
                /* Session ctty vnode pointer set in vnode layer. */
                if (!SESS_LEADER(p) ||
        case TIOCSCTTY:                 /* become controlling tty */
                /* Session ctty vnode pointer set in vnode layer. */
                if (!SESS_LEADER(p) ||
-                   p->p_session->s_ttyvp ||
-                   (tp->t_session && tp->t_session != p->p_session))
+                   (p->p_session->s_ttyvp || tp->t_session) &&
+                   (tp->t_session != p->p_session))
                        return (EPERM);
                tp->t_session = p->p_session;
                tp->t_pgrp = p->p_pgrp;
                        return (EPERM);
                tp->t_session = p->p_session;
                tp->t_pgrp = p->p_pgrp;