Re: Race conditions
Fred Blonder (fred@nasirc.hq.nasa.gov)
Fri, 9 Dec 1994 15:19:52 -0500
From: rwing!pat@ole.cdac.com (Pat Myrto)
And if a temp file MUST be made, use the mkstemp()
call to generate the name and open it. Mkstemp()
atomically generates the tempname from the template,
opens the file and returns a handle. As the manpage
says, mkstemp() eliminates the race condition between
testing if a file exists, and the opening of the tmp file.
But 'mkstemp()' is in section 3 of the manual; it's a subroutine,
not a system call, so how can it be 'atomic'?