summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdio/flags.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/stdio/flags.c')
-rw-r--r--lib/libc/stdio/flags.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c
index 0b6b075..e445fed 100644
--- a/lib/libc/stdio/flags.c
+++ b/lib/libc/stdio/flags.c
@@ -97,6 +97,7 @@ __sflags(mode, optr)
/* 'x' means exclusive (fail if the file exists) */
if (*mode == 'x') {
+ mode++;
if (m == O_RDONLY) {
errno = EINVAL;
return (0);
@@ -104,6 +105,10 @@ __sflags(mode, optr)
o |= O_EXCL;
}
+ /* set close-on-exec */
+ if (*mode == 'e')
+ o |= O_CLOEXEC;
+
*optr = m | o;
return (ret);
}
OpenPOWER on IntegriCloud