adaint.c (__gnat_tmp_name): Refine the generation of temporary names for RTX.
authorJose Ruiz <ruiz@adacore.com>
Fri, 1 Aug 2008 08:34:50 +0000 (10:34 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Fri, 1 Aug 2008 08:34:50 +0000 (10:34 +0200)
2008-08-01  Jose Ruiz  <ruiz@adacore.com>

* adaint.c (__gnat_tmp_name): Refine the generation of temporary names
for RTX. Adding a suffix that is incremented at each iteration.

From-SVN: r138482

gcc/ada/adaint.c

index c131357..03a0ff4 100644 (file)
@@ -983,8 +983,12 @@ void
 __gnat_tmp_name (char *tmp_filename)
 {
 #ifdef RTX
-  /* RTX in RTSS mode does not support tempnam nor tmpnam */
-  strcpy (tmp_filename, "c:\\WINDOWS\\Temp\\gnat-XXXXXX");
+  /* Variable used to create a series of unique names */
+  static int counter = 0;
+
+  /* RTX in RTSS mode does not support tempnam nor tmpnam so we emulate it */
+  strcpy (tmp_filename, "c:\\WINDOWS\\Temp\\gnat-");
+  sprintf (&tmp_filename[strlen (tmp_filename)], "%d\0", counter++);
 
 #elif defined (__MINGW32__)
   {