* fbsd-proc.c: Include "regcache.h", "regset.h" and
[deliverable/binutils-gdb.git] / bfd / cache.c
index 9146c05caca698febe0159986ad3665abcdc96d8..58eda916bbc9052263f6e40527d0d0c5dab5502c 100644 (file)
@@ -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))
 
  */
 
@@ -336,6 +336,10 @@ bfd_cache_close (bfd *abfd)
   if (abfd->iovec != &cache_iovec)
     return TRUE;
 
+  if (abfd->iostream == NULL)
+    /* Previously closed.  */
+    return TRUE;
+
   return bfd_cache_delete (abfd);
 }
 
@@ -434,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 *
@@ -457,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;
This page took 0.024005 seconds and 4 git commands to generate.