]> Savannah Git Hosting - gnulib.git/commitdiff
fopen-gnu: Create files correctly (regression from 2020-05-24).
authorBruno Haible <bruno@clisp.org>
Tue, 28 Jul 2020 19:01:06 +0000 (21:01 +0200)
committerBruno Haible <bruno@clisp.org>
Tue, 28 Jul 2020 19:01:06 +0000 (21:01 +0200)
* lib/fopen.c (rpl_open): Pass a third argument to open().

ChangeLog
lib/fopen.c

index 1b3f49aa25081d76452e8f13740c652513338072..ab35d855a9aba4b060cf50c584246f0ddc22c084 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2020-07-28  Bruno Haible  <bruno@clisp.org>
+
+       fopen-gnu: Create files correctly (regression from 2020-05-24).
+       * lib/fopen.c (rpl_open): Pass a third argument to open().
+
 2020-07-27  Paul Eggert  <eggert@cs.ucla.edu>
 
        xalloc-die: don’t depend on xalloc
index 0acffa25cf6c9fed358aa7687faedca921742068..4a0cab17c621f01724246f6f98ee062174025150 100644 (file)
@@ -176,7 +176,8 @@ rpl_fopen (const char *filename, const char *mode)
             return NULL;
           }
 
-        fd = open (filename, open_direction | open_flags);
+        fd = open (filename, open_direction | open_flags,
+                   S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
         if (fd < 0)
           return NULL;
 
@@ -209,7 +210,8 @@ rpl_fopen (const char *filename, const char *mode)
       int fd;
       FILE *fp;
 
-      fd = open (filename, open_direction | open_flags);
+      fd = open (filename, open_direction | open_flags,
+                 S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
       if (fd < 0)
         return NULL;