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
procedure Free is new Unchecked_Deallocation (Buf, Buf_Ptr);
begin
+ -- Check for invalid descriptors, making sure that we do not
+ -- accidentally leave an open file descriptor around.
+
if From = Invalid_FD then
+ if To /= Invalid_FD then
+ Close (To, Status_To);
+ end if;
+
raise Copy_Error;
elsif To = Invalid_FD then