summaryrefslogtreecommitdiff
path: root/bfd/cache.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2005-10-26 04:29:53 +0000
committerAlan Modra <amodra@bigpond.net.au>2005-10-26 04:29:53 +0000
commit7a1ace6a0f5732a0c82594326c075b3d08474bfc (patch)
tree027e93c7dee8b37855ff2105360c861eb9d3fb28 /bfd/cache.c
parent5d6b744fef1b8fc2af51dca8baae78b11761e68d (diff)
downloadbinutils-redhat-7a1ace6a0f5732a0c82594326c075b3d08474bfc.tar.gz
* 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.
Diffstat (limited to 'bfd/cache.c')
-rw-r--r--bfd/cache.c21
1 files changed, 13 insertions, 8 deletions
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);
}
+ 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
- {
- 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;
+ bfd_perror ("Cannot continue");
+ abort ();
+ return NULL;
}