Perform cleanup in bfd_close after errors
authorAlan Modra <amodra@gmail.com>
Fri, 27 Jan 2023 04:46:03 +0000 (15:16 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 27 Jan 2023 05:16:45 +0000 (15:46 +1030)
commit8219cab3f883cb9981e533407d3ce93d9da7d5f2
treeca38a261183eec8671130af3d7224c29afc1a802
parent3e7cde4dca8c63b8091597bd7800f0f71e822395
Perform cleanup in bfd_close after errors

It seems reasonable to continue after errors in bfd_close_all_done,
particularly since bfd_close_all_done is typically called on an output
file after we've hit some sort of error elsewhere.  The iovec test is
necessary if bfd_close_all_done is to work on odd bfd's opened by
bfd_create.

* opncls.c (bfd_close): Call bfd_close_all_done after errors
from _bfd_write_contents.
(bfd_close_all_done): Call _bfd_delete_bfd after errors.
Don't call iovec->bclose when iovec is NULL.
bfd/opncls.c