|[ tempnam only] If set, the directory in which the temporary file is stored. TMPDIR is ignored for processes for which issetugid(2) is true.|
These interfaces are provided from System V and ANSI compatibility only.
Most historic implementations of these functions provide only a limited number of possible temporary file names (usually 26) before file names will start being recycled. System V implementations of these functions (and of mktemp(3)) use the access(2) system call to determine whether or not the temporary file may be created. This has obvious ramifications for setuid or setgid programs, complicating the portable use of these interfaces in such programs.
The tmpfile interface should not be used in software expected to be used on other systems if there is any possibility that the user does not wish the temporary file to be publicly readable and writable.
The tmpfile function may fail and set the global variable errno for any of the errors specified for the library functions fdopen(3) or mkstemp(3).
The tmpnam function may fail and set errno for any of the errors specified for the library function mktemp(3).
The tmpfile and tmpnam functions conform to -isoC.
The tmpnam and tempnam functions are susceptible to a race condition occurring between the selection of the file name and the creation of the file, which allows malicious users to potentially overwrite arbitrary files in the system, depending on the level of privilege of the running program. Additionally, there is no means by which file permissions may be specified. It is strongly suggested that mkstemp(3) be used in place of these functions.