This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Fix handling of temporary files in text_io


Tested on x86-linux, committed on mainline.

As the length of the path of a temporary file could exceed L_tmpnam,
in some circumstances, a temporary file would not be deleted at the
end of execution of the program. This change ensures that the
path of the temporary files will be recorded correctly and these
temporary files will be effectively deleted at the end of execution.
The test for this is tmptest.adb. Environment variable TMP should
be set to an existing writable directory with a relatively long path.
The test succeeds if no new file starting with a name starting with
"gnat-" is created in the TMP dir.
--
with Ada.Text_IO; use Ada.Text_IO;
procedure TmpTest is
   F : File_Type;
begin
   Create (F, Out_File, ""); Put_Line (F, "Hello World"); Close (F);
end TmpTest;

2005-01-03  Vincent Celier  <celier@adacore.com>

	* s-fileio.adb (Temp_File_Record): Change length of string component
	Name from L_tmpnam + 1 to max_path_len + 1.

Attachment: difs.23
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]