aboutsummaryrefslogtreecommitdiff
path: root/bfd/aout-encap.c
diff options
context:
space:
mode:
authorJeff Law <law@redhat.com>1994-03-26 18:28:29 +0000
committerJeff Law <law@redhat.com>1994-03-26 18:28:29 +0000
commit250578363e45567f5168e913f58959dd10575ba8 (patch)
treeca1f77735e1ecb4169a578509949bffbe1499ebf /bfd/aout-encap.c
parent649694ea87ae0cbd4355ac0d68f27e6052fc10e4 (diff)
downloadgdb-250578363e45567f5168e913f58959dd10575ba8.zip
gdb-250578363e45567f5168e913f58959dd10575ba8.tar.gz
gdb-250578363e45567f5168e913f58959dd10575ba8.tar.bz2
* libbfd.c (bfd_read): Set bfd_error as appropriate for a short
read. (bfd_error_system_call or bfd_error_file_truncated). * som.c: Do not blindly set bfd_error_system_call after a failing bfd_read, bfd_write, or bfd_seek. In a few places (like som_object_p) override the error status set by bfd_read. * aix386-core.c, aout-encap,c archive.c, bout.c: Likewise. * coff-rs6000.c, coffgen.c ecoff.c, elf.c: Likewise. * elf32-hppa.c, elfcode.h, hp300hpux.c, i386lynx.c: Likewise. * nlm32-alpha.c, nlm32-i386.c, nlm32-sparc.c: Likewise. * som.c: Check return values from several bfd_{seek,read,write} calls that we just assumed were not failing.
Diffstat (limited to 'bfd/aout-encap.c')
-rw-r--r--bfd/aout-encap.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/bfd/aout-encap.c b/bfd/aout-encap.c
index 20c44bf..0d468f2 100644
--- a/bfd/aout-encap.c
+++ b/bfd/aout-encap.c
@@ -47,11 +47,13 @@ encap_object_p (abfd)
struct external_exec exec_bytes;
struct internal_exec exec;
- bfd_set_error (bfd_error_system_call);
-
if (bfd_read ((PTR)magicbuf, 1, sizeof (magicbuf), abfd) !=
sizeof (magicbuf))
- return 0;
+ {
+ if (bfd_get_error () != bfd_error_system_call)
+ bfd_set_error (bfd_error_wrong_format);
+ return 0;
+ }
coff_magic = bfd_h_get_16 (abfd, magicbuf);
if (coff_magic != COFF_MAGIC)