summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred Perlstein <alfred@FreeBSD.org>2002-01-13 12:57:02 +0000
committerAlfred Perlstein <alfred@FreeBSD.org>2002-01-13 12:57:02 +0000
commitc2824dd49bde0f4375f4911359979f392ea0c0b8 (patch)
treecdb3deba3804dd672dc5e1e26a971f473c2b8073
parentda10530228e9ba82b7064e2c7fa87c907167e64e (diff)
Notes
-rw-r--r--sys/kern/kern_descrip.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 1538698b11aa..ad89597d8327 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1464,19 +1464,11 @@ ffind_hold(td, fd)
struct thread *td;
int fd;
{
- struct filedesc *fdp;
struct file *fp;
- if (td == NULL || (fdp = td->td_proc->p_fd) == NULL)
- return (NULL);
- FILEDESC_LOCK(fdp);
- if (fd < 0 || fd >= fdp->fd_nfiles ||
- (fp = fdp->fd_ofiles[fd]) == NULL ||
- fp->f_ops == &badfileops)
- fp = NULL;
- else
- fhold(fp);
- FILEDESC_UNLOCK(fdp);
+ fp = ffind_lock(td, fd);
+ if (fp != NULL)
+ FILE_UNLOCK(fp);
return (fp);
}