aboutsummaryrefslogtreecommitdiff
path: root/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-02-21 13:28:40 +0100
committerMartin Ridgers <[email protected]>2022-02-21 13:28:40 +0100
commit9910aa2db475c47ff97f4239e2393a940663685f (patch)
treedefc14379d3f7b1aefd0c893f0dcb0fcfd34f156 /zencore/filesystem.cpp
parentLinux compile fix (diff)
downloadzen-9910aa2db475c47ff97f4239e2393a940663685f.tar.xz
zen-9910aa2db475c47ff97f4239e2393a940663685f.zip
If open(O_CREAT) is used then a file mode must be given
Diffstat (limited to 'zencore/filesystem.cpp')
-rw-r--r--zencore/filesystem.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/zencore/filesystem.cpp b/zencore/filesystem.cpp
index 7cd71e4b4..79563190c 100644
--- a/zencore/filesystem.cpp
+++ b/zencore/filesystem.cpp
@@ -436,7 +436,7 @@ CloneFile(std::filesystem::path FromPath, std::filesystem::path ToPath)
ScopedFd $From = { FromFd };
// The 'to' file
- int ToFd = open(ToPath.c_str(), O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC);
+ int ToFd = open(ToPath.c_str(), O_WRONLY|O_CREAT|O_EXCL|O_CLOEXEC, 0666);
if (ToFd < 0)
{
return false;
@@ -503,7 +503,7 @@ CopyFile(std::filesystem::path FromPath, std::filesystem::path ToPath, const Cop
ScopedFd $From = {FromFd};
// To file
- int ToFd = open(ToPath.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC);
+ int ToFd = open(ToPath.c_str(), O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0666);
if (ToFd < 0)
{
ThrowLastError(fmt::format("failed to create file {}", ToPath));
@@ -560,11 +560,11 @@ WriteFile(std::filesystem::path Path, const IoBuffer* const* Data, size_t Buffer
#else
int OpenFlags = O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC;
- int Fd = open(Path.c_str(), OpenFlags);
+ int Fd = open(Path.c_str(), OpenFlags, 0666);
if (Fd < 0)
{
zen::CreateDirectories(Path.parent_path());
- Fd = open(Path.c_str(), OpenFlags);
+ Fd = open(Path.c_str(), OpenFlags, 0666);
}
if (Fd < 0)