if (del && bfd_get_arch (this_element) == bfd_arch_unknown)
/* Try again as an unknown object file. */
ok_object = false;
- else if (!bfd_close (output_bfd))
- {
- bfd_nonfatal_message (output_name, NULL, NULL, NULL);
- /* Error in new object file. Don't change archive. */
- status = 1;
- }
}
if (!ok_object)
+ del = !copy_unknown_object (this_element, output_bfd);
+
+ if (!(ok_object && !del ? bfd_close : bfd_close_all_done) (output_bfd))
{
- del = !copy_unknown_object (this_element, output_bfd);
- if (!bfd_close_all_done (output_bfd))
- {
- bfd_nonfatal_message (output_name, NULL, NULL, NULL);
- /* Error in new object file. Don't change archive. */
- status = 1;
- }
+ bfd_nonfatal_message (output_name, NULL, NULL, NULL);
+ /* Error in new object file. Don't change archive. */
+ status = 1;
}
if (del)
*ptr = NULL;
filename = bfd_get_filename (obfd);
- if (!bfd_close (obfd))
+ if (!(status == 0 ? bfd_close : bfd_close_all_done) (obfd))
{
status = 1;
bfd_nonfatal_message (filename, NULL, NULL, NULL);