On Solaris, mkstemp() uses a 0600 parameter as well. This seems to
be the rpoper thing to do.
It is interesting to note that tmpfile() *MUST* use mode 0666; even though
a file exists only fr a very short while, standard compliance tests
include the honoring of the umask as part of the tests.
Solaris 2.6 tmpfile() was changed to use mkstemp(), but it needs to
fchmod() afterwards for standards complaince. Originally, mkstemp()
was changed to use mode 0666 during development, but I quickly got them
to mend their ways.
Solaris 2.6 tmpfile() does perform the unlink() *before* the fchmod(),
so there's no way anyone will ever get to read/write your temporary
file.
More importantly, tmpfile() is not safe in most SV derived implementations.
Solaris 2.x tmpfile() isn't safe until release 2.6; I'm pretty
sure that AIX and IRIX tmpfile() aren't safe either; at least, they
weren't safe back then.
Casper