diff options
| author | Martin Ridgers <[email protected]> | 2022-02-21 12:53:47 +0100 |
|---|---|---|
| committer | Martin Ridgers <[email protected]> | 2022-02-21 12:53:47 +0100 |
| commit | f3722e2c7e27131be8395dedc9fcbb6a73cda80d (patch) | |
| tree | f363e44b32191779ba19b5b648362281dc89e1ae /zen/internalfile.cpp | |
| parent | Allow all users and groups to read/write files (POSIX) (diff) | |
| download | archived-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.cpp | 6 |
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)); } |