libite
|
#include <errno.h>
#include <paths.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/stat.h>
Functions | |
FILE * | tempfile (void) |
A secure tmpfile() replacement. More... | |
FILE* tempfile | ( | void | ) |
A secure tmpfile() replacement.
This is the secure replacement for tmpfile() that does not exist in GLIBC. It uses the Linux specific O_TMPFILE
and O_EXCL
to hide the filename. When the FILE
is fclose()'ed, the file contents is lost. The file is hidden in the _PATH_TMP
("/tmp") directory in the system.
This function requires Linux 3.11, or later, due to O_TMPFILE
. Not all file systems support hidden inodes, in which case this function defaults to call tmpfile() as a fallback.
FILE
pointer, or NULL
on error.