if (m_PidFile == NULL)
BOOST_THROW_EXCEPTION(runtime_error("Could not open PID file '" + filename + "'"));
+#ifdef F_GETFL
+ int flags;
+ flags = fcntl(fd, F_GETFL, 0);
+ if (flags < 0)
+ BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
+
+ if (fcntl(fd, F_SETFL, flags | FD_CLOEXEC) < 0)
+ BOOST_THROW_EXCEPTION(PosixException("fcntl failed", errno));
+#endif /* FD_CLOEXEC */
+
#ifndef _WIN32
if (flock(fileno(m_PidFile), LOCK_EX | LOCK_NB) < 0) {
ClosePidFile();
{
m_PkgDataDir = path;
}
-