summaryrefslogtreecommitdiff
path: root/lib/libc/stdio/flags.c
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2012-11-15 03:50:36 +0000
committerchristos <christos@NetBSD.org>2012-11-15 03:50:36 +0000
commitd233ce18b7be2652afefd94e5202fa47b57c32fa (patch)
tree94d5ec20b65aec0b48ff735e814927bad68b63e5 /lib/libc/stdio/flags.c
parent2e9611457ae0ac96b54bbe941db0ae38e9201844 (diff)
Add 'x' to the mode bits to specify O_EXCL, like glibc.
Diffstat (limited to 'lib/libc/stdio/flags.c')
-rw-r--r--lib/libc/stdio/flags.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/libc/stdio/flags.c b/lib/libc/stdio/flags.c
index 1892d02e5e8..eac46f9a41a 100644
--- a/lib/libc/stdio/flags.c
+++ b/lib/libc/stdio/flags.c
@@ -1,4 +1,4 @@
-/* $NetBSD: flags.c,v 1.16 2012/03/15 18:22:30 christos Exp $ */
+/* $NetBSD: flags.c,v 1.17 2012/11/15 03:50:36 christos Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -37,7 +37,7 @@
#if 0
static char sccsid[] = "@(#)flags.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: flags.c,v 1.16 2012/03/15 18:22:30 christos Exp $");
+__RCSID("$NetBSD: flags.c,v 1.17 2012/11/15 03:50:36 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -90,6 +90,7 @@ __sflags(const char *mode, int *optr)
* [rwa]\+ or [rwa]b\+ means read and write
* f means open only plain files,
* e means set close on exec.
+ * x means exclusive open.
*/
for (; *mode; mode++)
switch (*mode) {
@@ -103,6 +104,9 @@ __sflags(const char *mode, int *optr)
case 'e':
o |= O_CLOEXEC;
break;
+ case 'x':
+ o |= O_EXCL;
+ break;
case 'b':
break;
default: /* We could produce a warning here */