aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-10-05 22:03:13 +0000
committerPer Bothner <per@bothner.com>1992-10-05 22:03:13 +0000
commit446c5af7c2ef1137b6026b5a6fdccdf13f7b9088 (patch)
treedac4af79b14e2f51f4ee70ebe14265303fa0d9e8 /bfd/archive.c
parent286fd2f9e5b403feac83499586ef66c69d9a3073 (diff)
downloadgdb-446c5af7c2ef1137b6026b5a6fdccdf13f7b9088.zip
gdb-446c5af7c2ef1137b6026b5a6fdccdf13f7b9088.tar.gz
gdb-446c5af7c2ef1137b6026b5a6fdccdf13f7b9088.tar.bz2
Tweak previous change (only assume malformed_archive if errno == 0).
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 3fa9362..747745a 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -98,6 +98,11 @@ DESCRIPTION
#include "libbfd.h"
#include "aout/ar.h"
#include "aout/ranlib.h"
+#include <errno.h>
+
+#ifndef errno
+extern int errno;
+#endif
#ifdef GNU960
#define BFD_GNU960_ARMAG(abfd) (BFD_COFF_FILE_P((abfd)) ? ARMAG : ARMAGB)
@@ -265,9 +270,6 @@ get_extended_arelt_filename (arch, name)
bfd *arch;
char *name;
{
-#ifndef errno
- extern int errno;
-#endif
unsigned long index = 0;
/* Should extract string so that I can guarantee not to overflow into
@@ -1217,7 +1219,9 @@ _bfd_write_archive_contents (arch)
if (amt > remaining) {
amt = remaining;
}
+ errno = 0;
if (bfd_read (buffer, amt, 1, current) != amt) {
+ if (errno) goto syserr;
/* Looks like a truncated archive. */
bfd_error = malformed_archive;
return false;