From 221f2898b9140b4cc103d2c485061023706c1fcf Mon Sep 17 00:00:00 2001 From: Nicolas Cavallari Date: Wed, 7 Apr 2021 19:08:23 +0200 Subject: open: Add support for O_TMPFILE Since Linux 3.11, O_TMPFILE allows to create unnamed files that can be linked later on. It is internally defined as (O_TMPFILE | O_DIRECTORY) to make it fail on old kernels. Copying definitions from glibc for O_TMPFILE is not enough to support O_TMPFILE; The open() wrapper also need to pass the mode when the flag contains O_TMPFILE, otherwise, it will pass mode 000 which will succeed but yield unexpected results. openat() is curiously not affected since it passes the mode unconditionally.. Signed-off-by: Nicolas Cavallari --- include/fcntl.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'include/fcntl.h') diff --git a/include/fcntl.h b/include/fcntl.h index 35797c689..136f64d70 100644 --- a/include/fcntl.h +++ b/include/fcntl.h @@ -104,8 +104,9 @@ libc_hidden_proto(fcntl64) #endif /* Open FILE and return a new file descriptor for it, or -1 on error. - OFLAG determines the type of access used. If O_CREAT is on OFLAG, - the third argument is taken as a `mode_t', the mode of the created file. + OFLAG determines the type of access used. If O_CREAT or O_TMPFILE + is on OFLAG, the third argument is taken as a `mode_t', the mode of + the created file. This function is a cancellation point and therefore not marked with __THROW. */ -- cgit v1.2.3