diff options
author | Jan Beulich <jbeulich@novell.com> | 2005-05-06 06:32:43 +0000 |
---|---|---|
committer | Jan Beulich <jbeulich@novell.com> | 2005-05-06 06:32:43 +0000 |
commit | a580b8e05174aa8dd67b0bae41037182aba6b418 (patch) | |
tree | cabbe2da114c29eabe39587ca7353709da0983b3 /binutils/objcopy.c | |
parent | 8368879b1281a8961391c955a9a671b9fe82b352 (diff) | |
download | gdb-a580b8e05174aa8dd67b0bae41037182aba6b418.zip gdb-a580b8e05174aa8dd67b0bae41037182aba6b418.tar.gz gdb-a580b8e05174aa8dd67b0bae41037182aba6b418.tar.bz2 |
binutils/
2005-05-06 Jan Beulich <jbeulich@novell.com>
* objcopy.c (copy_file): Don't delete output upon error here.
(copy_main): Delete output upon error.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r-- | binutils/objcopy.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c index dfaa1bcaf..a3bd95e 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) |