Eric Blake wrote:
> git recently started using mkstemps on systems that provide it (new enough
> Solaris has it in <stdlib.h>, some BSD have it in <unistd.h> even though
> it is not standardized,

Indeed, the platforms that have it are: OpenBSD >= 2.4, FreeBSD >= 2.4,
MacOS X [1], OpenSolaris [2].

> I've just proposed adding it to Cygwin via newlib).  The general idea of
> creating temporary files with a known suffix is nice.

It can also be done by using mkdtemp and then creating a file with arbitrary
name in the temporary directory. That approach is also more extensible: It
allows not only the suffix, but the entire file name to be a given one. It
keeps several temporary files from a single process together. It reduces the
amount of directory entries in /tmp.

> Should we modify tempname.c's gen_tempname to also provide the 
> ability to implement mkstemps?

If you find this function worth using, no objection.

Bruno


[1] 
http://developer.apple.com/documentation/Darwin/Reference/ManPages/man3/mkstemps.3.html
[2] http://docs.sun.com/app/docs/doc/819-2243/mkstemps-3c?a=view


Reply via email to