You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@corinthia.apache.org by "Dennis E. Hamilton" <de...@acm.org> on 2015/02/13 11:00:29 UTC

RE: [12/38] incubator-corinthia git commit: Get rid of DFCreateTempDir

Out of curiosity, is there a way to create a temporary output *file* on Windows that does not have the race condition?  I thought that was possible with a write-exclusive must-not-exist temporary, and collisions could be detected and recovered from.

That may not be needed here, but it would be useful to know how to do it for other tools that might have multiple instances running and also left-overs from earlier executions.

Once the new exclusive file can be opened for output, that should signal that a directory with a related name is also available, so long as the convention of reserving names this way is used by all executions of shared code.

 - Dennis

-----Original Message-----
From: jani@apache.org [mailto:jani@apache.org] 
Sent: Friday, February 13, 2015 00:52
To: commits@corinthia.incubator.apache.org
Subject: [12/38] incubator-corinthia git commit: Get rid of DFCreateTempDir

[ ... ]

DFCreateTempDir used to rely on mkdtemp, which generates temporary
directories in a secure manner (that is, avoiding a race condition
between the directory's creation time and the application getting
exclusive access to it). However, this function is not available on
windows, leaving us with the choice of having an #ifdef WIN32 to use a
fixed directory name on windows, or doing the same thing on all
platforms. Compiling on Linux would give a warning about the mktemp
function being unsafe.


[ ... ]