bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fopen-gnu: Create files correctly


From: Bruno Haible
Subject: fopen-gnu: Create files correctly
Date: Tue, 28 Jul 2020 21:03:19 +0200
User-agent: KMail/5.1.3 (Linux/4.4.0-186-generic; KDE/5.18.0; x86_64; ; )

A test failure on Solaris 11.3 indicates that something is wrong with the
'fopen-gnu' module. Namely, newly created files have incorrect access
permissions. This patch fixes it.


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().

diff --git a/lib/fopen.c b/lib/fopen.c
index 0acffa2..4a0cab1 100644
--- a/lib/fopen.c
+++ b/lib/fopen.c
@@ -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;
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]