aboutsummaryrefslogtreecommitdiff
path: root/bfd/archive.c
diff options
context:
space:
mode:
authorH.J. Lu <hjl.tools@gmail.com>2021-07-26 05:37:57 -0700
committerH.J. Lu <hjl.tools@gmail.com>2021-07-26 16:21:47 -0700
commit5b37a5ca1d2e90ea1fc29593046428f7ed116a7f (patch)
tree4002223ba1a1cee6fb93d444f08014181477b05e /bfd/archive.c
parent4b41648fff32bb1fdf26bc6440323795f453862e (diff)
downloadgdb-5b37a5ca1d2e90ea1fc29593046428f7ed116a7f.zip
gdb-5b37a5ca1d2e90ea1fc29593046428f7ed116a7f.tar.gz
gdb-5b37a5ca1d2e90ea1fc29593046428f7ed116a7f.tar.bz2
bfd: Set error to bfd_error_malformed_archive only if unset
When reading an archive member, set error to bfd_error_malformed_archive on open_nested_file failure only if the error is unset. PR ld/28138 * archive.c (_bfd_get_elt_at_filepos): Don't set error to bfd_error_malformed_archive if it has been set.
Diffstat (limited to 'bfd/archive.c')
-rw-r--r--bfd/archive.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/bfd/archive.c b/bfd/archive.c
index 5f350b8..3868fc9 100644
--- a/bfd/archive.c
+++ b/bfd/archive.c
@@ -713,8 +713,9 @@ _bfd_get_elt_at_filepos (bfd *archive, file_ptr filepos)
/* It's not an element of a nested archive;
open the external file as a bfd. */
+ bfd_set_error (bfd_error_no_error);
n_bfd = open_nested_file (filename, archive);
- if (n_bfd == NULL)
+ if (n_bfd == NULL && bfd_get_error () == bfd_error_no_error)
bfd_set_error (bfd_error_malformed_archive);
}
else