Plug a leak of open files that happens when you exec a suid program

with one of std{in,out,err} open. This helps with the file descriptor
leaks reported on -current. This should probably be merged into 5.2.

Reviewed by:	ru
Tested by:	Bjoern A. Zeeb <bzeeb-lists@lists.zabbadoz.net>
This commit is contained in:
David Malone 2003-12-28 19:27:14 +00:00
parent ab05eab129
commit 70ad6c2190
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=123939

View file

@ -1730,6 +1730,7 @@ fdcheckstd(td)
fp->f_type = DTYPE_VNODE;
VOP_UNLOCK(nd.ni_vp, 0, td);
devnull = fd;
fdrop(fp, td);
} else {
error = do_dup(td, DUP_FIXED, devnull, i, &retval);
if (error != 0)