aboutsummaryrefslogtreecommitdiff
path: root/zen/internalfile.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-02-21 12:53:47 +0100
committerMartin Ridgers <[email protected]>2022-02-21 12:53:47 +0100
commitf3722e2c7e27131be8395dedc9fcbb6a73cda80d (patch)
treef363e44b32191779ba19b5b648362281dc89e1ae /zen/internalfile.cpp
parentAllow all users and groups to read/write files (POSIX) (diff)
downloadarchived-zen-f3722e2c7e27131be8395dedc9fcbb6a73cda80d.tar.xz
archived-zen-f3722e2c7e27131be8395dedc9fcbb6a73cda80d.zip
Explicitly set access permissions so we're not affected by process' umask
Diffstat (limited to 'zen/internalfile.cpp')
-rw-r--r--zen/internalfile.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/zen/internalfile.cpp b/zen/internalfile.cpp
index 8f1ca5c03..354ec2221 100644
--- a/zen/internalfile.cpp
+++ b/zen/internalfile.cpp
@@ -182,9 +182,13 @@ InternalFile::OpenWrite(std::filesystem::path FileName, bool IsCreate)
int OpenFlags = O_RDWR | O_CLOEXEC;
OpenFlags |= IsCreate ? O_CREAT | O_TRUNC : 0;
- int Fd = open(FileName.c_str(), OpenFlags, 0666);
+ int Fd = open(FileName.c_str(), OpenFlags);
if (Fd >= 0)
{
+ if (IsCreate)
+ {
+ fchmod(Fd, 0666);
+ }
Success = true;
m_File = (void*)(intptr_t(Fd));
}