* Makefile.am: Use a temporary file to build chew.
[deliverable/binutils-gdb.git] / binutils / objcopy.c
index dfaa1bcaf61d6a6710919cb26f515a03ebcf87f2..d8feae60d8fbf3c952add55a32f758acd0d53205 100644 (file)
@@ -17,8 +17,8 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 \f
 #include "bfd.h"
 #include "progress.h"
@@ -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.023386 seconds and 4 git commands to generate.