diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2010-10-21 19:11:14 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2010-10-21 19:11:14 +0000 |
commit | dfd2f2d4bbb5f23cd14bca63b73779ffbac5c0f5 (patch) | |
tree | 506464413c40d2c6a4a46d04892a9415cb886522 /contrib/binutils/bfd/bfdwin.c | |
parent | ae36f9474fd730d29afb8b25c92dba33dedf7480 (diff) | |
parent | 7a815afd9b5121ee0f65dc1e1de1c0de6de97679 (diff) |
Merge ^vendor/binutils/dist@214082 into contrib/binutils.
Notes
Notes:
svn path=/projects/binutils-2.17/; revision=214157
Diffstat (limited to 'contrib/binutils/bfd/bfdwin.c')
-rw-r--r-- | contrib/binutils/bfd/bfdwin.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/contrib/binutils/bfd/bfdwin.c b/contrib/binutils/bfd/bfdwin.c index fb7c967bff3b..7236906e28bc 100644 --- a/contrib/binutils/bfd/bfdwin.c +++ b/contrib/binutils/bfd/bfdwin.c @@ -1,5 +1,6 @@ /* Support for memory-mapped windows into a BFD. - Copyright 1995, 1996, 2001, 2002, 2003 Free Software Foundation, Inc. + Copyright 1995, 1996, 2001, 2002, 2003, 2005 + Free Software Foundation, Inc. Written by Cygnus Support. This file is part of BFD, the Binary File Descriptor library. @@ -16,7 +17,7 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ #include "sysdep.h" @@ -144,7 +145,6 @@ bfd_get_file_window (bfd *abfd, file_ptr file_offset, offset2; size_t real_size; int fd; - FILE *f; /* Find the real file and the real offset into it. */ while (abfd->my_archive != NULL) @@ -152,8 +152,13 @@ bfd_get_file_window (bfd *abfd, offset += abfd->origin; abfd = abfd->my_archive; } - f = bfd_cache_lookup (abfd); - fd = fileno (f); + + /* Seek into the file, to ensure it is open if cacheable. */ + if (abfd->iostream == NULL + && (abfd->iovec == NULL + || abfd->iovec->bseek (abfd, offset, SEEK_SET) != 0)) + return FALSE; + fd = fileno ((FILE *) abfd->iostream); /* Compute offsets and size for mmap and for the user's data. */ offset2 = offset % pagesize; |