Commit 0e3e1f15 by Robert Dewar Committed by Arnaud Charlet

g-os_lib.adb (Copy_File): Make sure that if From has an Invalid_FD, then we…

g-os_lib.adb (Copy_File): Make sure that if From has an Invalid_FD, then we close To if it is valid.

2006-02-17  Robert Dewar  <dewar@adacore.com>

	* g-os_lib.adb (Copy_File): Make sure that if From has an Invalid_FD,
	then we close To if it is valid.

From-SVN: r111188
parent 7f9747c6
...@@ -384,7 +384,14 @@ package body GNAT.OS_Lib is ...@@ -384,7 +384,14 @@ package body GNAT.OS_Lib is
procedure Free is new Unchecked_Deallocation (Buf, Buf_Ptr); procedure Free is new Unchecked_Deallocation (Buf, Buf_Ptr);
begin begin
-- Check for invalid descriptors, making sure that we do not
-- accidentally leave an open file descriptor around.
if From = Invalid_FD then if From = Invalid_FD then
if To /= Invalid_FD then
Close (To, Status_To);
end if;
raise Copy_Error; raise Copy_Error;
elsif To = Invalid_FD then elsif To = Invalid_FD then
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment