From 5c91cdfb252222206a3a1139de7b6200b421e043 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Wed, 26 Oct 2005 04:29:53 +0000 Subject: [PATCH] * cache.c (bfd_open_file): Set bfd_error_system_call on failure to open file. (bfd_cache_lookup_worker): Remove check that file pos is in unsigned long range. Print system error before aborting. --- bfd/ChangeLog | 7 +++++++ bfd/cache.c | 23 ++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index c12c6ace83..a1e35e0b1d 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,10 @@ +2005-10-26 Alan Modra + + * cache.c (bfd_open_file): Set bfd_error_system_call on failure + to open file. + (bfd_cache_lookup_worker): Remove check that file pos is in + unsigned long range. Print system error before aborting. + 2005-10-25 Arnold Metselaar * Makefile.am: Add rules for coff-z80 and cpu-z80. diff --git a/bfd/cache.c b/bfd/cache.c index e2524fbf15..e9f38ab6b4 100644 --- a/bfd/cache.c +++ b/bfd/cache.c @@ -447,7 +447,9 @@ bfd_open_file (bfd *abfd) break; } - if (abfd->iostream != NULL) + if (abfd->iostream == NULL) + bfd_set_error (bfd_error_system_call); + else { if (! bfd_cache_init (abfd)) return NULL; @@ -489,14 +491,17 @@ bfd_cache_lookup_worker (bfd *abfd) snip (abfd); insert (abfd); } - } - else - { - 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; } - return (FILE *) abfd->iostream; + if (bfd_open_file (abfd) == NULL) + ; + else if (real_fseek ((FILE *) abfd->iostream, abfd->where, SEEK_SET) != 0) + bfd_set_error (bfd_error_system_call); + else + return (FILE *) abfd->iostream; + + bfd_perror ("Cannot continue"); + abort (); + return NULL; }