Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This call to open() fails whenever /tmp/some_file already exists, including when it is a symbolic link. This is a good thing, but a temporary file is presumably still required. One approach that can be used with open() is to generate random file names and attempt to open() each until a unique name is discovered. Luckily, there are predefined functions that perform this function.

Wiki Markup
Care should be observed when using {{O_EXCL}} with remote file systems as it does not work with NFS version 2. NFS version 3 added support for {{O_EXCL}} mode in {{open()}}; see IETF RFC 1813 \[[Callaghan 95|AA. C References#Callaghan 95]\], in particular the {{EXCLUSIVE}} value to the {{mode}} argument of {{CREATE}}. 

Non-Compliant Code Example: tmpnam()

...