finding ....
Pixel
pixel@mandrakesoft.com
20 Mar 2002 11:42:31 +0100
"D. Tweed" <tweed@cs.bris.ac.uk> writes:
[...]
> > Could someone post an example of the creation of a
> > temporary file where race conditions are important?
>
> myscript wants to create a temporary file called /tmp/storedStuff
> being half-careful, checks file doesn't exist
> (*) miniscule delay occurs
> creates a new file called /tmp/storedStuff
and of course, the solution is to open(file, ... | O_EXCL | O_CREAT)
that way if someone wants to trick you it fails nicely, and in other cases
everything is nice :)