From edb75eca277dcb4272a0054e92592f65441f7cdb Mon Sep 17 00:00:00 2001 From: Doug Ambrisko Date: Tue, 16 May 2006 17:57:00 +0000 Subject: Fix file leaking in translate_path_major_minor. --- sys/compat/linux/linux_stats.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'sys/compat/linux/linux_stats.c') diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index d35377c9e167..f19019a3fc0f 100644 --- a/sys/compat/linux/linux_stats.c +++ b/sys/compat/linux/linux_stats.c @@ -122,6 +122,8 @@ translate_fd_major_minor(struct thread *td, int fd, struct stat *buf) static void translate_path_major_minor(struct thread *td, char *path, struct stat *buf) { + struct proc *p = td->td_proc; + struct filedesc *fdp = p->p_fd; struct file *fp; int fd; int temp; @@ -132,8 +134,10 @@ translate_path_major_minor(struct thread *td, char *path, struct stat *buf) fd = td->td_retval[0]; td->td_retval[0] = temp; translate_fd_major_minor(td, fd, buf); - fget(td, fd, &fp); - closef(fp, td); + FILEDESC_LOCK(fdp); + fp = fdp->fd_ofiles[fd]; + FILEDESC_UNLOCK(fdp); + fdclose(fdp, fdp->fd_ofiles[fd], fd, td); } static int -- cgit v1.3