...
When two or more users or a group of users have write permission to a directory, the potential for deception is far greater than it is for shared access to a few files. Consequently, temporary files in shared directories must be
- created unpredictable file names,
- created with unique and unpredictable file namesnames,
- opened only if the file doesn't already exist (atomic open),
- opened with exclusive access,
- opened with appropriate permissions, and
- removed before the program exits, andopened with appropriate permissions.
The following table lists common temporary file functions and their respective conformance to these criteria:
Conformance of File Functions to Criteria for Temporary Files
|
|
|
|
|
|
|
---|---|---|---|---|---|---|
Unpredictable Name | not portably | yes | not portably | yes | not portably | not portably |
Unique Name | yes | yes | yes | yes | yes | yes |
Atomic open | no | no | yes | yes | no | yes |
Exclusive Access | possible | possible | no | if supported by OS | possible | if supported by OS |
Appropriate Permissions | possible | possible | no | if supported by OS | possible | not portably |
File Removed | no | no | yes* | yes* | no | no |
...