aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/filemon
diff options
context:
space:
mode:
authorBryan Drewery <bdrewery@FreeBSD.org>2016-01-27 19:11:11 +0000
committerBryan Drewery <bdrewery@FreeBSD.org>2016-01-27 19:11:11 +0000
commitfac4a7ac31e0f6dba8dc1dbd1469563102a6c710 (patch)
treec52878e0ac8f96ca8c21df7e75873237ccd0ea01 /sys/dev/filemon
parent7aebc1bce2ca5500d8c9803f88e544b940491867 (diff)
downloadsrc-fac4a7ac31e0f6dba8dc1dbd1469563102a6c710.tar.gz
src-fac4a7ac31e0f6dba8dc1dbd1469563102a6c710.zip
Drop any previous fd when setting a new one.
Reported by: mjg Sponsored by: EMC / Isilon Storage Division MFC after: 2 weeks
Notes
Notes: svn path=/head/; revision=294933
Diffstat (limited to 'sys/dev/filemon')
-rw-r--r--sys/dev/filemon/filemon.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sys/dev/filemon/filemon.c b/sys/dev/filemon/filemon.c
index b302de9f6924..4721d0a0c45d 100644
--- a/sys/dev/filemon/filemon.c
+++ b/sys/dev/filemon/filemon.c
@@ -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),