Phil Ruffwind rf at
Sat Feb 21 07:38:00 UTC 2015

> If openBinaryTempFile is used in this way a few times in a row, it returns
> the same file name every time.

A quick inspection of the [source code][1] reveals that it uses the process ID
(PID) to generate the initial filename of the temporary file.  If the file
already exists, the number is incremented until a new file is created.  So the
current implementation does in fact have this predictable behavior.

I don't *think* this is insecure (but don't quote me on that), since `O_EXCL`
is used to create the file, but it may be somewhat inefficient if there are a
many files being created by one process or if processes with similar IDs
create temporary files with this method.


More information about the Libraries mailing list