From 55a098e55a0c857249438a5b1ac53e94b0c3d43e Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Sun, 3 Oct 2021 06:10:38 -0700 Subject: [PATCH] Change default open mode to -rw-r--r-- (#2530) --- src/os.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/os.cc b/src/os.cc index 934629d71bd7a..9572631b29f5e 100644 --- a/src/os.cc +++ b/src/os.cc @@ -32,10 +32,15 @@ # ifndef S_IRUSR # define S_IRUSR _S_IREAD # endif - # ifndef S_IWUSR # define S_IWUSR _S_IWRITE # endif +# ifndef S_IRGRP +# define S_IRGRP _S_IRGRP +# endif +# ifndef S_IROTH +# define S_IROTH _S_IROTH +# endif # ifdef __MINGW32__ # define _SH_DENYNO 0x40 @@ -213,7 +218,7 @@ int buffered_file::fileno() const { #if FMT_USE_FCNTL file::file(cstring_view path, int oflag) { - int mode = S_IRUSR | S_IWUSR; + int mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH; # if defined(_WIN32) && !defined(__MINGW32__) fd_ = -1; FMT_POSIX_CALL(sopen_s(&fd_, path.c_str(), oflag, _SH_DENYNO, mode));