in reply to Re: Avoiding a race condition
in thread Avoiding a race condition

This is correct. In fact, it is a very common practice for temporary files to unlink them right after opening them. Only the processes that already had them open will be able to continue accessing them, and the file will magically vanish when the last process closes it.

From the unlink(2) man page under Linux:

If the name was the last link to a file but any processes still have the file open the file will remain in existence until the last file descriptor referring to it is closed.

--ZZamboni

Replies are listed 'Best First'.
RE: RE: Re: Avoiding a race condition
by takshaka (Friar) on May 19, 2000 at 06:10 UTC
    This is a common practice for unix. Not all platforms allow you to unlink an open file.
      Very true. I'm not very used to think in non-Unix terms... :-)

      --ZZamboni