mirror of
https://git.FreeBSD.org/src.git
synced 2024-11-29 08:08:37 +00:00
FILEMON_SET_FD: Disallow changing the fd.
MFC after: 1 week Suggested by: mjg Sponsored by: EMC / Isilon Storage Division
This commit is contained in:
parent
c3d1c73fa9
commit
044fd54366
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=296575
@ -31,7 +31,7 @@
|
||||
.\"
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd January 28, 2016
|
||||
.Dd March 9, 2016
|
||||
.Dt FILEMON 4
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -125,6 +125,19 @@ function returns the value 0 if successful;
|
||||
otherwise the value \-1 is returned and the global variable
|
||||
.Va errno
|
||||
is set to indicate the error.
|
||||
.Sh ERRORS
|
||||
The
|
||||
.Fn ioctl
|
||||
system call
|
||||
with
|
||||
.Dv FILEMON_SET_FD
|
||||
will fail if:
|
||||
.Bl -tag -width Er
|
||||
.It Bq Er EEXIST
|
||||
The
|
||||
.Nm
|
||||
handle is already associated with a file descriptor.
|
||||
.El
|
||||
.Sh FILES
|
||||
.Bl -tag -width ".Pa /dev/filemon"
|
||||
.It Pa /dev/filemon
|
||||
|
@ -163,8 +163,10 @@ 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);
|
||||
if (filemon->fp != NULL) {
|
||||
error = EEXIST;
|
||||
break;
|
||||
}
|
||||
|
||||
error = fget_write(td, *(int *)data,
|
||||
cap_rights_init(&rights, CAP_PWRITE),
|
||||
|
Loading…
Reference in New Issue
Block a user