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 /zenstore/filecas.cpp | |
| parent | Allow all users and groups to read/write files (POSIX) (diff) | |
| download | zen-f3722e2c7e27131be8395dedc9fcbb6a73cda80d.tar.xz zen-f3722e2c7e27131be8395dedc9fcbb6a73cda80d.zip | |
Explicitly set access permissions so we're not affected by process' umask
Diffstat (limited to 'zenstore/filecas.cpp')
| -rw-r--r-- | zenstore/filecas.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/zenstore/filecas.cpp b/zenstore/filecas.cpp index f2f4465cc..5c7edef29 100644 --- a/zenstore/filecas.cpp +++ b/zenstore/filecas.cpp @@ -388,7 +388,14 @@ FileCasStrategy::InsertChunk(const void* const ChunkData, const size_t ChunkSize } #else // Attempt to exclusively create the file. - auto InternalCreateFile = [&] { return open(Name.ShardedPath.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0666); }; + auto InternalCreateFile = [&] { + int Fd = open(Name.ShardedPath.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC); + if (Fd >= 0) + { + fchmod(Fd, 0666); + } + return Fd; + }; int Fd = InternalCreateFile(); if (Fd < 0) { |