NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

standards/60335: fcntl.h in POSIX 2008 or later mode lacks O_EXEC



>Number:         60335
>Category:       standards
>Synopsis:       fcntl.h in POSIX 2008 or later mode lacks O_EXEC
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    standards-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 15 19:10:01 +0000 2026
>Originator:     Haelwenn Monnier
>Release:        10.0
>Organization:
>Environment:
NetBSD build 10.0 NetBSD 10.0 (GENERIC) #0: Thu Mar 28 08:33:33 UTC 2024  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64
>Description:
POSIX.1-2008 added O_EXEC to fcntl.h
>How-To-Repeat:
Use `#define _POSIX_C_SOURCE  200809L` without also defining `_NETBSD_SOURCE` and try to use O_EXEC.
>Fix:
Untested patch but very likely correct:

diff --git a/sys/sys/fcntl.h b/sys/sys/fcntl.h
--- a/sys/sys/fcntl.h
+++ b/sys/sys/fcntl.h
@@ -112,21 +112,21 @@
 #define        O_DIRECT        0x00080000      /* direct I/O hint */
 #endif

 #define        O_DIRECTORY     0x00200000      /* fail if not a directory */
 #define        O_CLOEXEC       0x00400000      /* set close on exec */
 #if (_POSIX_C_SOURCE - 0) >= 200809L || (_XOPEN_SOURCE - 0 >= 700) || \
     defined(_NETBSD_SOURCE)
 #define        O_SEARCH        0x00800000      /* skip search permission checks */
+#define        O_EXEC          0x04000000      /* open for executing only */
 #endif
 #if defined(_NETBSD_SOURCE)
 #define        O_NOSIGPIPE     0x01000000      /* don't deliver sigpipe */
 #define        O_REGULAR       0x02000000      /* fail if not a regular file */
-#define        O_EXEC          0x04000000      /* open for executing only */
 #endif
 #if (_POSIX_C_SOURCE - 0) >= 202405L || (_XOPEN_SOURCE - 0 >= 800) || \
        defined(_NETBSD_SOURCE)
 #define        O_CLOFORK       0x08000000      /* set close on fork */
 #endif

 #ifdef _KERNEL
 /* convert from open() flags to/from fflags; convert O_RD/WR to FREAD/FWRITE */




Home | Main Index | Thread Index | Old Index