aboutsummaryrefslogtreecommitdiff
path: root/bfd/cache.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2004-05-05 15:39:11 +0000
committerNick Clifton <nickc@redhat.com>2004-05-05 15:39:11 +0000
commit06fc8a8ce6dc6e3896c672e2b809fc9a44077fed (patch)
tree6a4f69d5dd07e13a8404edbb70810bf64128140b /bfd/cache.c
parent6b6e92f432c86611c81a5da6880946bad25b59dc (diff)
downloadgdb-06fc8a8ce6dc6e3896c672e2b809fc9a44077fed.zip
gdb-06fc8a8ce6dc6e3896c672e2b809fc9a44077fed.tar.gz
gdb-06fc8a8ce6dc6e3896c672e2b809fc9a44077fed.tar.bz2
PR/136 - Have bfd_cache_lookup_worker() abort rather than return an
(unchecked-for) NULL.
Diffstat (limited to 'bfd/cache.c')
-rw-r--r--bfd/cache.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/bfd/cache.c b/bfd/cache.c
index 0586061..58eda91 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -189,9 +189,9 @@ bfd *bfd_last_cache;
otherwise, it has to perform the complicated lookup function.
.#define bfd_cache_lookup(x) \
- . ((x)==bfd_last_cache? \
- . (FILE*) (bfd_last_cache->iostream): \
- . bfd_cache_lookup_worker(x))
+ . ((x) == bfd_last_cache ? \
+ . (FILE *) (bfd_last_cache->iostream): \
+ . bfd_cache_lookup_worker (x))
*/
@@ -438,7 +438,8 @@ DESCRIPTION
quick answer. Find a file descriptor for @var{abfd}. If
necessary, it open it. If there are already more than
<<BFD_CACHE_MAX_OPEN>> files open, it tries to close one first, to
- avoid running out of file descriptors.
+ avoid running out of file descriptors. It will abort rather than
+ returning NULL if it is unable to (re)open the @var{abfd}.
*/
FILE *
@@ -461,12 +462,10 @@ bfd_cache_lookup_worker (bfd *abfd)
}
else
{
- if (bfd_open_file (abfd) == NULL)
- return NULL;
- if (abfd->where != (unsigned long) abfd->where)
- return NULL;
- if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
- return NULL;
+ if (bfd_open_file (abfd) == NULL
+ || abfd->where != (unsigned long) abfd->where
+ || real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0)
+ abort ();
}
return (FILE *) abfd->iostream;