From owner-svn-src-all@FreeBSD.ORG Fri Jan 2 23:39:31 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 646691065766; Fri, 2 Jan 2009 23:39:31 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA11B8FC1D; Fri, 2 Jan 2009 23:39:29 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n02NdTmP010588; Fri, 2 Jan 2009 23:39:29 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n02NdTjf010587; Fri, 2 Jan 2009 23:39:29 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200901022339.n02NdTjf010587@svn.freebsd.org> From: Ed Schouten Date: Fri, 2 Jan 2009 23:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r186707 - head/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 02 Jan 2009 23:39:32 -0000 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);