binutils/
authorJan Beulich <jbeulich@novell.com>
Fri, 6 May 2005 06:32:43 +0000 (06:32 +0000)
committerJan Beulich <jbeulich@novell.com>
Fri, 6 May 2005 06:32:43 +0000 (06:32 +0000)
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.

binutils/ChangeLog
binutils/objcopy.c

index b0f24308f9123aa42dec9b97979672f2a8324832..0bea73071323ea1ec5bedb879cceec174604fa30 100644 (file)
@@ -1,3 +1,8 @@
+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.
+
 2005-05-02  Ben Elliston  <bje@au.ibm.com>
 
        * dlltool.c (dtab): Remove empty function.
index dfaa1bcaf61d6a6710919cb26f515a03ebcf87f2..a3bd95e21003d05c867779cb69a1e08a7ec29cf3 100644 (file)
@@ -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)
This page took 0.033308 seconds and 4 git commands to generate.