summaryrefslogtreecommitdiff
path: root/libc/stdlib/mkostemp.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib/mkostemp.c')
-rw-r--r--libc/stdlib/mkostemp.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/stdlib/mkostemp.c b/libc/stdlib/mkostemp.c
index 0369235dc..912be30a6 100644
--- a/libc/stdlib/mkostemp.c
+++ b/libc/stdlib/mkostemp.c
@@ -17,6 +17,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include <fcntl.h>
#include "../misc/internals/tempname.h"
/* Generate a unique temporary file name from TEMPLATE.
@@ -26,5 +27,6 @@
int
mkostemp (char *template, int flags)
{
- return __gen_tempname (template, __GT_FILE, flags);
+ flags -= flags & O_ACCMODE; /* Remove O_RDONLY, O_WRONLY, and O_RDWR. */
+ return __gen_tempname (template, __GT_FILE, flags, S_IRUSR | S_IWUSR);
}