aboutsummaryrefslogtreecommitdiff
path: root/zenstore/filecas.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 /zenstore/filecas.cpp
parentAllow all users and groups to read/write files (POSIX) (diff)
downloadzen-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.cpp9
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)
{