*
*/
-#include "config.h"
+#include "mem_config.h"
#include "util/pidfile.hpp"
#include <sstream>
#include <sys/stat.h>
#include <sys/types.h>
+#include <unistd.h>
extern "C" {
}
}
+ int oflags= O_CREAT|O_WRONLY|O_TRUNC;
+#ifdef HAVE_O_CLOEXEC
+ oflags= oflags | O_CLOEXEC;
+#endif
+
int file;
- if ((file = open(_filename.c_str(), O_CREAT|O_WRONLY|O_TRUNC, S_IRWXU|S_IRGRP|S_IROTH)) < 0)
+ if ((file = open(_filename.c_str(), oflags, S_IRWXU|S_IRGRP|S_IROTH)) < 0)
{
std::stringstream error_stream;
error_stream << "Could not open pid file for writing: " << _filename << "(" << strerror(errno) << ")";