summaryrefslogtreecommitdiffstats
path: root/sys/kern/tty.c
diff options
context:
space:
mode:
Diffstat (limited to 'sys/kern/tty.c')
-rw-r--r--sys/kern/tty.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/sys/kern/tty.c b/sys/kern/tty.c
index 5c7b753..02eccd7 100644
--- a/sys/kern/tty.c
+++ b/sys/kern/tty.c
@@ -1840,23 +1840,15 @@ ttyhook_register(struct tty **rtp, struct proc *p, int fd,
int error, ref;
/* Validate the file descriptor. */
- if ((fdp = p->p_fd) == NULL)
- return (EBADF);
-
- fp = fget_unlocked(fdp, fd);
- if (fp == NULL)
- return (EBADF);
+ fdp = p->p_fd;
+ error = fget_unlocked(fdp, fd, CAP_TTYHOOK, 0, &fp, NULL);
+ if (error != 0)
+ return (error);
if (fp->f_ops == &badfileops) {
error = EBADF;
goto done1;
}
-#ifdef CAPABILITIES
- error = cap_funwrap(fp, CAP_TTYHOOK, &fp);
- if (error)
- goto done1;
-#endif
-
/*
* Make sure the vnode is bound to a character device.
* Unlocked check for the vnode type is ok there, because we
OpenPOWER on IntegriCloud