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

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)