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.)

Reply via email to