From: Per Bothner Date: Mon, 5 Oct 1992 22:03:13 +0000 (+0000) Subject: Tweak previous change (only assume malformed_archive if errno == 0). X-Git-Tag: gdb-4_18~20912 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=446c5af7c2ef1137b6026b5a6fdccdf13f7b9088;p=external%2Fbinutils.git Tweak previous change (only assume malformed_archive if errno == 0). --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index fbc5432..7788700 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,7 +1,8 @@ Mon Oct 5 14:32:55 1992 Per Bothner (bothner@cygnus.com) - * archive.c (_bfd_write_archive_contents): If read fails, - set bfd_error to malformed_archive (since this probably + * archive.c: Make errno global. + * archive.c (_bfd_write_archive_contents): If read fails (and + errno!=0) set bfd_error to malformed_archive (since this probably indicates a truncated archive), rather than system_call_error. Mon Oct 5 03:33:39 1992 Mark Eichin (eichin at tweedledumber.cygnus.com) 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 + +#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;