This is the mail archive of the gcc-bugs@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]

[Bug fortran/47439] Fun with scratch files on Windows MKTEMP only allows for 26 files


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


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