Bug 1052

Summary: [PATCH] Remove temp file if input file is unrecognized
Product: binutils Reporter: Ignacio Vazquez-Abrams <ivazquez>
Component: binutilsAssignee: unassigned
Status: RESOLVED FIXED    
Severity: normal CC: bug-binutils
Priority: P2    
Version: 2.15   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description Ignacio Vazquez-Abrams 2005-07-06 13:01:27 UTC
This patch causes strip to remove the temporary file created if it doesn't
recognize the format of the input file.

--- binutils-2.15.94.0.2.2/binutils/objcopy.c.tempkill  2005-07-06
07:27:16.000000000 -0400
+++ binutils-2.15.94.0.2.2/binutils/objcopy.c   2005-07-06 07:31:26.000000000 -0400
@@ -1167,8 +1167,11 @@
          || bfd_get_arch (ibfd) != bfd_get_arch (obfd)))
     {
       if (bfd_get_arch (ibfd) == bfd_arch_unknown)
+      {
+       unlink(bfd_get_filename (obfd));
        fatal (_("Unable to recognise the format of the input file %s"),
               bfd_get_filename (ibfd));
+      }
       else
        {
          non_fatal (_("Warning: Output file cannot represent architecture %s"),
Comment 1 Alan Modra 2005-08-23 07:57:10 UTC
This has been fixed on mainline.