From 65f7250d7f0ddbf916758acd1a91d313e57ca0f1 Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Sat, 1 Feb 2014 04:32:51 +0100 Subject: Windows: fix library update, handle errors during elaboration. --- libraries.adb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'libraries.adb') diff --git a/libraries.adb b/libraries.adb index 0b07dc32b..e0306f42d 100644 --- a/libraries.adb +++ b/libraries.adb @@ -1287,8 +1287,11 @@ package body Libraries is & Back_End.Library_To_File_Name (Library); Delete_Success : Boolean; begin + -- For windows: renames doesn't overwrite destination; so first + -- delete it. This can create races condition on Unix: if the + -- program is killed between delete and rename, the library is lost. + Delete_File (File_Name, Delete_Success); Rename_File (Temp_Name.all, File_Name, Success); - Delete_File (Temp_Name.all, Delete_Success); Free (Temp_Name); if not Success then Error_Msg ("cannot update library file """ & File_Name & """"); -- cgit v1.2.3