Drop any previous fd when setting a new one.

Reported by:	mjg
Sponsored by:	EMC / Isilon Storage Division
MFC after:	2 weeks
This commit is contained in:
bdrewery 2016-01-27 19:11:11 +00:00
parent 57a7c410cb
commit 4019d3df8f

View File

@ -148,6 +148,9 @@ filemon_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag __unused,
switch (cmd) {
/* Set the output file descriptor. */
case FILEMON_SET_FD:
if (filemon->fp != NULL)
fdrop(filemon->fp, td);
error = fget_write(td, *(int *)data,
#if __FreeBSD_version >= 900041
cap_rights_init(&rights, CAP_PWRITE),