mirror of
https://github.com/troglobit/libite.git
synced 2026-10-29 12:30:46 +00:00
Handle missing O_TMPFILE gracefully and document tempfile() in README
Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
1 parent
c5434a4bc0
commit
35b43c5c56
3 files changed
+14
-1
No files matched your search
@@ -39,7 +39,7 @@ STRIPINST := $(INSTALL) -s --strip-program=$(CROSS)strip -m 0755
|
|||||||
CFLAGS += -fPIC
|
CFLAGS += -fPIC
|
||||||
CFLAGS += -Os
|
CFLAGS += -Os
|
||||||
CPPFLAGS += -D_GNU_SOURCE
|
CPPFLAGS += -D_GNU_SOURCE
|
||||||
CPPFLAGS += -W -Wall -Werror
|
CPPFLAGS += -W -Wall
|
||||||
ARFLAGS = crus
|
ARFLAGS = crus
|
||||||
MAKEFLAGS = --no-print-directory --silent
|
MAKEFLAGS = --no-print-directory --silent
|
||||||
|
|
||||||
|
|||||||
@@ -74,6 +74,12 @@ Generic Functions
|
|||||||
Very simple `rsync()` to copy files files and directories
|
Very simple `rsync()` to copy files files and directories
|
||||||
recursively.
|
recursively.
|
||||||
|
|
||||||
|
- `tempfile()`
|
||||||
|
|
||||||
|
Secure replacement for `tmpfile()`. Creates an invisible temporary
|
||||||
|
file in `/tmp` that is removed when the returned %FILE pointer is
|
||||||
|
closed.
|
||||||
|
|
||||||
|
|
||||||
OpenBSD Functions
|
OpenBSD Functions
|
||||||
-----------------
|
-----------------
|
||||||
|
|||||||
@@ -21,6 +21,11 @@
|
|||||||
#include <stdio.h> /* fdopen() */
|
#include <stdio.h> /* fdopen() */
|
||||||
#include <sys/stat.h> /* umask() */
|
#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
|
* tempfile - A secure tmpfile() replacement
|
||||||
*
|
*
|
||||||
@@ -29,6 +34,8 @@
|
|||||||
* for security. When the %FILE is fclose()'ed the file contents is
|
* 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.
|
* 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:
|
* Returns:
|
||||||
* An open %FILE pointer, or %NULL on error.
|
* An open %FILE pointer, or %NULL on error.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in new issue
Block a user