Merge pull request #4627

bd482802 util: close keys file lock on exec (moneromooo-monero)
This commit is contained in:
Riccardo Spagni 2018-10-20 20:41:45 +02:00
commit effb22cfc4
No known key found for this signature in database
GPG key ID: 55432DF31CCD4FCD

View file

@ -233,7 +233,7 @@ namespace tools
MERROR("Failed to open " << filename << ": " << std::error_code(GetLastError(), std::system_category())); MERROR("Failed to open " << filename << ": " << std::error_code(GetLastError(), std::system_category()));
} }
#else #else
m_fd = open(filename.c_str(), O_RDONLY | O_CREAT, 0666); m_fd = open(filename.c_str(), O_RDONLY | O_CREAT | O_CLOEXEC, 0666);
if (m_fd != -1) if (m_fd != -1)
{ {
if (flock(m_fd, LOCK_EX | LOCK_NB) == -1) if (flock(m_fd, LOCK_EX | LOCK_NB) == -1)