From a580b8e05174aa8dd67b0bae41037182aba6b418 Mon Sep 17 00:00:00 2001 From: Jan Beulich Date: Fri, 6 May 2005 06:32:43 +0000 Subject: [PATCH] binutils/ 2005-05-06 Jan Beulich * objcopy.c (copy_file): Don't delete output upon error here. (copy_main): Delete output upon error. --- binutils/ChangeLog | 5 +++++ binutils/objcopy.c | 11 ++++------- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index b0f24308f9..0bea730713 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2005-05-06 Jan Beulich + + * objcopy.c (copy_file): Don't delete output upon error here. + (copy_main): Delete output upon error. + 2005-05-02 Ben Elliston * dlltool.c (dtab): Remove empty function. diff --git a/binutils/objcopy.c b/binutils/objcopy.c index dfaa1bcaf6..a3bd95e210 100644 --- a/binutils/objcopy.c +++ b/binutils/objcopy.c @@ -1731,7 +1731,6 @@ copy_file (const char *input_filename, const char *output_filename, else if (bfd_check_format_matches (ibfd, bfd_object, &obj_matching)) { bfd *obfd; - bfd_boolean delete; do_copy: /* bfd_get_target does not return the correct value until @@ -1743,7 +1742,8 @@ copy_file (const char *input_filename, const char *output_filename, if (obfd == NULL) RETURN_NONFATAL (output_filename); - delete = ! copy_object (ibfd, obfd); + if (! copy_object (ibfd, obfd)) + status = 1; if (!bfd_close (obfd)) RETURN_NONFATAL (output_filename); @@ -1751,11 +1751,6 @@ copy_file (const char *input_filename, const char *output_filename, if (!bfd_close (ibfd)) RETURN_NONFATAL (input_filename); - if (delete) - { - unlink_if_ordinary (output_filename); - status = 1; - } } else { @@ -3054,6 +3049,8 @@ copy_main (int argc, char *argv[]) if (status == 0 && preserve_dates) set_times (output_filename, &statbuf); + else if (status != 0) + unlink_if_ordinary (output_filename); } if (change_warn) -- 2.34.1