diff mbox

[Ada] Delete response file even when link failed

Message ID 20151027115033.GA46928@adacore.com
State New
Headers show

Commit Message

Arnaud Charlet Oct. 27, 2015, 11:50 a.m. UTC
When a response file was created and the link failed, the response file
was not deleted. It is deleted now.

Tested on x86_64-pc-linux-gnu, committed on trunk

2015-10-27  Vincent Celier  <celier@adacore.com>

	* gnatlink.adb: Always delete the response file, even when the
	invocation of gcc to link failed.
diff mbox

Patch

Index: gnatlink.adb
===================================================================
--- gnatlink.adb	(revision 229413)
+++ gnatlink.adb	(working copy)
@@ -1859,6 +1859,10 @@ 
    --  been compiled.
 
    if Opt.CodePeer_Mode then
+      if Tname_FD /= Invalid_FD then
+         Delete (Tname);
+      end if;
+
       return;
    end if;
 
@@ -2052,16 +2056,14 @@ 
 
          System.OS_Lib.Spawn (Linker_Path.all, Args, Success);
 
-         if Success then
+         --  Delete the temporary file used in conjunction with linking if one
+         --  was created. See Process_Bind_File for details.
 
-            --  Delete the temporary file used in conjunction with linking
-            --  if one was created. See Process_Bind_File for details.
+         if Tname_FD /= Invalid_FD then
+            Delete (Tname);
+         end if;
 
-            if Tname_FD /= Invalid_FD then
-               Delete (Tname);
-            end if;
-
-         else
+         if not Success then
             Error_Msg ("error when calling " & Linker_Path.all);
             Exit_Program (E_Fatal);
          end if;