aboutsummaryrefslogtreecommitdiff
path: root/zenstore/basicfile.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2022-02-21 12:42:42 +0100
committerMartin Ridgers <[email protected]>2022-02-21 12:42:42 +0100
commitcea930e12929859608c102a378c01c209b523688 (patch)
tree1fc44e5cf629529aa9f0c6e413cc8efc9236d6a9 /zenstore/basicfile.cpp
parentValue propagation fix - Read/Write ValueAPI as CompressedBinary type when wri... (diff)
downloadzen-cea930e12929859608c102a378c01c209b523688.tar.xz
zen-cea930e12929859608c102a378c01c209b523688.zip
Marked a few file descriptors to be closed on execute (POSIX)
Diffstat (limited to 'zenstore/basicfile.cpp')
-rw-r--r--zenstore/basicfile.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/zenstore/basicfile.cpp b/zenstore/basicfile.cpp
index dcd9a8575..038d83493 100644
--- a/zenstore/basicfile.cpp
+++ b/zenstore/basicfile.cpp
@@ -72,7 +72,7 @@ BasicFile::Open(std::filesystem::path FileName, bool IsCreate, std::error_code&
return;
}
#else
- int OpenFlags = O_RDWR;
+ int OpenFlags = O_RDWR | O_CLOEXEC;
OpenFlags |= IsCreate ? O_CREAT | O_TRUNC : 0;
int Fd = open(FileName.c_str(), OpenFlags, 0666);
@@ -366,7 +366,7 @@ LockFile::Create(std::filesystem::path FileName, CbObject Payload, std::error_co
return;
}
#elif ZEN_PLATFORM_LINUX || ZEN_PLATFORM_MAC
- int Fd = open(FileName.c_str(), O_RDWR | O_CREAT, 0666);
+ int Fd = open(FileName.c_str(), O_RDWR | O_CREAT | O_CLOEXEC, 0666);
if (Fd < 0)
{
Ec = zen::MakeErrorCodeFromLastError();