This ensures unicity of temp filenames across processes under Windows. Tested on i686-pc-mingw32, committed on trunk
2011-08-04 Pascal Obry <o...@adacore.com> * adaint.c (__gnat_tmp_name): Use current process id to create temp filenames, this ensures unicity of filenames across processes.
Index: adaint.c =================================================================== --- adaint.c (revision 177328) +++ adaint.c (working copy) @@ -1177,13 +1177,15 @@ #elif defined (__MINGW32__) { char *pname; + char prefix[25]; /* tempnam tries to create a temporary file in directory pointed to by TMP environment variable, in c:\temp if TMP is not set, and in directory specified by P_tmpdir in stdio.h if c:\temp does not exist. The filename will be created with the prefix "gnat-". */ - pname = (char *) _tempnam ("c:\\temp", "gnat-"); + sprintf (prefix, "gnat-%d-", (int)getpid()); + pname = (char *) _tempnam ("c:\\temp", prefix); /* if pname is NULL, the file was not created properly, the disk is full or there is no more free temporary files */