commit:     775921d02b2d1fea48e6232520497c2ad7431975
Author:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
AuthorDate: Fri Sep 11 07:11:35 2015 +0000
Commit:     Mike Frysinger <vapier <AT> gentoo <DOT> org>
CommitDate: Fri Sep 11 07:11:35 2015 +0000
URL:        https://gitweb.gentoo.org/proj/sandbox.git/commit/?id=775921d0

libsandbox: handle open's O_TMPFILE flag

This new flag needs us to unpack & pass down the mode rather than
always sending in the value of 0.

URL: http://bugs.gentoo.org/529044
Reported-by: Aidan Thornton <makosoft <AT> googlemail.com>
Signed-off-by: Mike Frysinger <vapier <AT> gentoo.org>

 libsandbox/wrapper-funcs/openat.c | 2 +-
 localdecls.h                      | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/libsandbox/wrapper-funcs/openat.c 
b/libsandbox/wrapper-funcs/openat.c
index 3e46ad5..846c63f 100644
--- a/libsandbox/wrapper-funcs/openat.c
+++ b/libsandbox/wrapper-funcs/openat.c
@@ -24,7 +24,7 @@
 
 #define WRAPPER_SAFE_POST_EXPAND \
        int mode = 0; \
-       if (flags & O_CREAT) { \
+       if (flags & (O_CREAT | O_TMPFILE)) { \
                va_list ap; \
                va_start(ap, flags); \
                mode = va_arg(ap, int); \

diff --git a/localdecls.h b/localdecls.h
index be99617..0e11fea 100644
--- a/localdecls.h
+++ b/localdecls.h
@@ -52,6 +52,9 @@
 #ifndef O_CLOEXEC
 # define O_CLOEXEC 0
 #endif
+#ifndef O_TMPFILE
+# define O_TMPFILE 0
+#endif
 
 #if !HAVE_DECL_ENVIRON
 extern char **environ;

Reply via email to