From 5e50baa16ef90204d9048a9e2f23c5a538955121 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Tue, 28 Jul 2020 21:01:06 +0200 Subject: [PATCH] fopen-gnu: Create files correctly (regression from 2020-05-24). * lib/fopen.c (rpl_open): Pass a third argument to open(). --- ChangeLog | 5 +++++ lib/fopen.c | 6 ++++-- 2 files changed, 9 insertions(+), 2 deletions(-) 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; -- 2.39.5