[PATCH 3/4] tools/nolibc: pass mode to open syscall if O_TMPFILE is set
From: Thomas Weißschuh
Date: Wed Apr 29 2026 - 10:56:31 EST
When O_TMPFILE is set, the open mode needs to be passed to the kernel as
per the documentation.
Fixes: a7604ba149e7 ("tools/nolibc/sys: make open() take a vararg on the 3rd argument")
Signed-off-by: Thomas Weißschuh <linux@xxxxxxxxxxxxxx>
---
tools/include/nolibc/fcntl.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/include/nolibc/fcntl.h b/tools/include/nolibc/fcntl.h
index d7ea02e1332d..c401419e12b1 100644
--- a/tools/include/nolibc/fcntl.h
+++ b/tools/include/nolibc/fcntl.h
@@ -20,7 +20,7 @@
({ \
mode_t _mode = 0; \
\
- if ((_flags) & O_CREAT) { \
+ if (((_flags) & O_CREAT) || (((_flags) & O_TMPFILE) == O_TMPFILE)) { \
va_list args; \
\
va_start(args, (_flags)); \
--
2.54.0