Browse Source

mkostemp64: clear flags, as mkostemp does

This should have been made in commit 9649721950 but was forgotten.

Signed-off-by: Carlos Santos <casantos@datacom.com.br>
Carlos Santos 5 years ago
parent
commit
89addcbf98
1 changed files with 2 additions and 1 deletions
  1. 2 1
      libc/stdlib/mkostemp64.c

+ 2 - 1
libc/stdlib/mkostemp64.c

@@ -15,9 +15,9 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
-#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
+#include <fcntl.h>
 #include "../misc/internals/tempname.h"
 
 /* Generate a unique temporary file name from TEMPLATE.
@@ -27,6 +27,7 @@
 int
 mkostemp64 (char *template, int flags)
 {
+  flags -= flags & O_ACCMODE; /* Remove O_RDONLY, O_WRONLY, and O_RDWR. */
   return __gen_tempname (template, __GT_BIGFILE, flags | O_LARGEFILE, 0,
                          S_IRUSR | S_IWUSR);
 }