summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/fdopen.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/fdopen.c')
-rw-r--r--lib/libc/stdio/fdopen.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/libc/stdio/fdopen.c b/lib/libc/stdio/fdopen.c
index e5d167a..fbe37e8 100644
--- a/lib/libc/stdio/fdopen.c
+++ b/lib/libc/stdio/fdopen.c
@@ -70,7 +70,8 @@ fdopen(int fd, const char *mode)
/* Make sure the mode the user wants is a subset of the actual mode. */
if ((fdflags = _fcntl(fd, F_GETFL, 0)) < 0)
return (NULL);
- tmp = fdflags & O_ACCMODE;
+ /* Work around incorrect O_ACCMODE. */
+ tmp = fdflags & (O_ACCMODE | O_EXEC);
if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
errno = EINVAL;
return (NULL);
OpenPOWER on IntegriCloud