Do not leak master pty or ptmx vnode.

Report and test case by:	Petr Salinger <Petr.Salinger seznam cz>
Reviewed by:	ed
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2010-04-08 08:58:18 +00:00
parent 500e8f26d7
commit 6d51747362
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206395

View File

@ -575,6 +575,15 @@ ptsdev_close(struct file *fp, struct thread *td)
tty_lock(tp);
tty_rel_gone(tp);
/*
* Open of /dev/ptmx or /dev/ptyXX changes the type of file
* from DTYPE_VNODE to DTYPE_PTS. vn_open() increases vnode
* use count, we need to decrement it, and possibly do other
* required cleanup.
*/
if (fp->f_vnode != NULL)
return (vnops.fo_close(fp, td));
return (0);
}