Source-Changes-HG archive

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

[src/trunk]: src/sys/kern Extra sanity checks: all char devices won't have an...



details:   https://anonhg.NetBSD.org/src/rev/69a57026a756
branches:  trunk
changeset: 552210:69a57026a756
user:      manu <manu%NetBSD.org@localhost>
date:      Sun Sep 21 18:40:38 2003 +0000

description:
Extra sanity checks: all char devices won't have an associated tty.

diffstat:

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

diffs (33 lines):

diff -r cf3c143fa5b6 -r 69a57026a756 sys/kern/tty.c
--- a/sys/kern/tty.c    Sun Sep 21 18:35:31 2003 +0000
+++ b/sys/kern/tty.c    Sun Sep 21 18:40:38 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: tty.c,v 1.156 2003/08/11 10:49:06 dsl Exp $    */
+/*     $NetBSD: tty.c,v 1.157 2003/09/21 18:40:38 manu Exp $   */
 
 /*-
  * Copyright (c) 1982, 1986, 1990, 1991, 1993
@@ -37,7 +37,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.156 2003/08/11 10:49:06 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tty.c,v 1.157 2003/09/21 18:40:38 manu Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1224,10 +1224,11 @@
        int             s;
        const struct cdevsw     *cdev;
 
-       cdev = cdevsw_lookup(dev);
-       if (cdev == NULL)
+        if (((cdev = cdevsw_lookup(dev)) == NULL) ||
+           (cdev->d_tty == NULL) ||
+           ((tp = (*cdev->d_tty)(dev)) == NULL))
                return (ENXIO);
-       tp = (*cdev->d_tty)(dev);
+
        switch (kn->kn_filter) {
        case EVFILT_READ:
                klist = &tp->t_rsel.sel_klist;



Home | Main Index | Thread Index | Old Index