1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-19 10:53:58 +00:00

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.
This commit is contained in:
Ed Schouten 2009-01-02 23:39:29 +00:00
parent 916501c81c
commit bcca92c0e5
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=186707

View File

@ -312,7 +312,8 @@ ttydev_close(struct cdev *dev, int fflag, int devtype, struct thread *td)
* 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);