Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 2 Jan 2009 23:39:29 +0000 (UTC)
From:      Ed Schouten <ed@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r186707 - head/sys/kern
Message-ID:  <200901022339.n02NdTjf010587@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: ed
Date: Fri Jan  2 23:39:29 2009
New Revision: 186707
URL: http://svn.freebsd.org/changeset/base/186707

Log:
  Fix a corner case in my previous commit.
  
  Even though there are not many setups that have absolutely no console
  device, make sure a close() on a TTY doesn't dereference a null pointer.

Modified:
  head/sys/kern/tty.c

Modified: head/sys/kern/tty.c
==============================================================================
--- head/sys/kern/tty.c	Fri Jan  2 23:32:43 2009	(r186706)
+++ head/sys/kern/tty.c	Fri Jan  2 23:39:29 2009	(r186707)
@@ -312,7 +312,8 @@ ttydev_close(struct cdev *dev, int fflag
 	 * Don't actually close the device if it is being used as the
 	 * console.
 	 */
-	if (strcmp(dev_console_filename, tty_devname(tp)) == 0)
+	if (dev_console_filename != NULL &&
+	    strcmp(dev_console_filename, tty_devname(tp)) == 0)
 		return (0);
 
 	tty_lock(tp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200901022339.n02NdTjf010587>