[Bug fortran/47439] Fun with scratch files on Windows MKTEMP only allows for 26 files
jb at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Jan 25 09:48:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47439
--- Comment #1 from Janne Blomqvist <jb at gcc dot gnu.org> 2011-01-25 09:28:14 UTC ---
Seems the reason for Windows _mktemp() behavior is due to replicating some
age-old BSD behavior. From the Linux mktemp(3) manpage:
BUGS
Never use mktemp(). Some implementations follow 4.3BSD and replace
XXXXXX by the current process ID and a single
letter, so that at most 26 different names can be returned. Since on
the one hand the names are easy to guess,
and on the other hand there is a race between testing whether the name
exists and opening the file, every use of
mktemp() is a security risk. The race is avoided by mkstemp(3).
(Needless to say, libgfortran use mkstemp() ifavailable, mktemp() is just a
fallback.)
More information about the Gcc-bugs
mailing list