mirror of
https://github.com/troglobit/libite.git
synced 2026-10-01 05:22:34 +07:00
Handle missing O_TMPFILE gracefully and document tempfile() in README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
@@ -21,6 +21,11 @@
|
||||
#include <stdio.h> /* fdopen() */
|
||||
#include <sys/stat.h> /* umask() */
|
||||
|
||||
#ifndef O_TMPFILE /* Too old GLIBC or kernel */
|
||||
#warning O_TMPFILE missing on your system, tempfile() may not work!
|
||||
#define O_TMPFILE 020200000 /* Define and let it fail at runtime */
|
||||
#endif
|
||||
|
||||
/**
|
||||
* tempfile - A secure tmpfile() replacement
|
||||
*
|
||||
@@ -29,6 +34,8 @@
|
||||
* for security. When the %FILE is fclose()'ed the file contents is
|
||||
* lost. The file is hidden in the %_PATH_TMP directory on the system.
|
||||
*
|
||||
* This function requires Linux 3.11, or later, due to %O_TMPFILE.
|
||||
*
|
||||
* Returns:
|
||||
* An open %FILE pointer, or %NULL on error.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user