diff options
author | ambrisko <ambrisko@FreeBSD.org> | 2006-05-16 17:57:00 +0000 |
---|---|---|
committer | ambrisko <ambrisko@FreeBSD.org> | 2006-05-16 17:57:00 +0000 |
commit | 9b2b7d405494c7a9ab5ed2418fea99139db0ad2d (patch) | |
tree | cf9be2d7c4f63ffae278c4f8e0a25a6c03a7bf3c /sys/compat | |
parent | 434ba872a4f0bdf13c2cb90362a9d360a1115953 (diff) | |
download | FreeBSD-src-9b2b7d405494c7a9ab5ed2418fea99139db0ad2d.zip FreeBSD-src-9b2b7d405494c7a9ab5ed2418fea99139db0ad2d.tar.gz |
Fix file leaking in translate_path_major_minor.
Diffstat (limited to 'sys/compat')
-rw-r--r-- | sys/compat/linux/linux_stats.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c index d35377c..f19019a 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 |