diff options
author | Alan Modra <amodra@bigpond.net.au> | 2005-10-27 04:06:35 +0000 |
---|---|---|
committer | Alan Modra <amodra@bigpond.net.au> | 2005-10-27 04:06:35 +0000 |
commit | 8f9577ec10ea2672fa569dedcba4deef117f17b0 (patch) | |
tree | da4c734a5ff9e9e69b4e1e9eeb149fc683d7bf31 /bfd/bfdwin.c | |
parent | 8e1ec1814837858382b7f605077bbb4117c9b26c (diff) | |
download | gdb-8f9577ec10ea2672fa569dedcba4deef117f17b0.tar.gz |
* bfdwin.c (bfd_get_file_window): Seek into file in place of
using bfd_cache_lookup.
Diffstat (limited to 'bfd/bfdwin.c')
-rw-r--r-- | bfd/bfdwin.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/bfd/bfdwin.c b/bfd/bfdwin.c index 1450ab0e969..7236906e28b 100644 --- a/bfd/bfdwin.c +++ b/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. @@ -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,10 +152,13 @@ bfd_get_file_window (bfd *abfd, offset += abfd->origin; abfd = abfd->my_archive; } - f = bfd_cache_lookup (abfd); - if (f == NULL) + + /* 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 (f); + fd = fileno ((FILE *) abfd->iostream); /* Compute offsets and size for mmap and for the user's data. */ offset2 = offset % pagesize; |