Module Name:    src
Committed By:   apb
Date:           Sat Oct 20 00:21:11 UTC 2012

Modified Files:
        src/sys/kern: tty_pty.c

Log Message:
Set tp->t_dev to the correct dev_t value in both ptmopen and ptsopen.
Depending on how the pty had been opened, t_dev could previously have
been set to NODEV.  This was probably harmless before, but it caused the
compatibility handler for the COMPAT_60_TIOCPTSNAME ioctl to fail for
ptys that were allocated by screen(1), but only if this was the first
time that the pty had ever been used.


To generate a diff of this commit:
cvs rdiff -u -r1.131 -r1.132 src/sys/kern/tty_pty.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/kern/tty_pty.c
diff -u src/sys/kern/tty_pty.c:1.131 src/sys/kern/tty_pty.c:1.132
--- src/sys/kern/tty_pty.c:1.131	Sat Sep 24 04:10:03 2011
+++ src/sys/kern/tty_pty.c	Sat Oct 20 00:21:10 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: tty_pty.c,v 1.131 2011/09/24 04:10:03 christos Exp $	*/
+/*	$NetBSD: tty_pty.c,v 1.132 2012/10/20 00:21:10 apb Exp $	*/
 
 /*
  * Copyright (c) 1982, 1986, 1989, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.131 2011/09/24 04:10:03 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty_pty.c,v 1.132 2012/10/20 00:21:10 apb Exp $");
 
 #include "opt_ptm.h"
 
@@ -338,6 +338,7 @@ ptsopen(dev_t dev, int flag, int devtype
 	pti = pt_softc[ptn];
 	tp = pti->pt_tty;
 	if (!ISSET(tp->t_state, TS_ISOPEN)) {
+		tp->t_dev = dev;
 		ttychars(tp);		/* Set up default chars */
 		tp->t_iflag = TTYDEF_IFLAG;
 		tp->t_oflag = TTYDEF_OFLAG;
@@ -569,6 +570,7 @@ ptcopen(dev_t dev, int flag, int devtype
 		mutex_spin_exit(&tty_lock);
 		return EIO;
 	}
+	tp->t_dev = dev;
 	tp->t_oproc = ptsstart;
 	mutex_spin_exit(&tty_lock);
 	(void)(*tp->t_linesw->l_modem)(tp, 1);

Reply via email to