From: Bruno Haible Date: Tue, 28 Jul 2020 19:01:06 +0000 (+0200) Subject: fopen-gnu: Create files correctly (regression from 2020-05-24). X-Git-Tag: v1.0~3846 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=5e50baa16ef90204d9048a9e2f23c5a538955121;p=gnulib.git fopen-gnu: Create files correctly (regression from 2020-05-24). * lib/fopen.c (rpl_open): Pass a third argument to open(). --- diff --git a/ChangeLog b/ChangeLog index 1b3f49aa25..ab35d855a9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2020-07-28 Bruno Haible + + 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 xalloc-die: don’t depend on xalloc diff --git a/lib/fopen.c b/lib/fopen.c index 0acffa25cf..4a0cab17c6 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;