LibCore: Prevent LockFile fd from leaking into child process

Fixes #9059
This commit is contained in:
Peter Elliott 2021-07-29 09:47:43 +10:00 committed by Gunnar Beutner
parent 15cdb702c2
commit 5d6bf83374
Notes: sideshowbarker 2024-07-18 07:56:32 +09:00

View File

@ -19,7 +19,7 @@ LockFile::LockFile(char const* filename, Type type)
if (!Core::File::ensure_parent_directories(m_filename))
return;
m_fd = open(filename, O_RDONLY | O_CREAT, 0666);
m_fd = open(filename, O_RDONLY | O_CREAT | O_CLOEXEC, 0666);
if (m_fd == -1) {
m_errno = errno;
return;