summaryrefslogtreecommitdiff
path: root/src/init.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/init.cpp')
-rw-r--r--src/init.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/init.cpp b/src/init.cpp
index b974f7cdd..be896ad63 100644
--- a/src/init.cpp
+++ b/src/init.cpp
@@ -221,7 +221,11 @@ static void write_pidfile()
std::ofstream stream(pidfile.str());
if (!stream.is_open())
throw CoreException("Can not write to PID file " + pidfile);
- stream << getpid() << std::endl;
+#ifdef _WIN32
+ stream << GetCurrentProcessId() << std::endl;
+#else
+ stream << getpid() << std::endl;
+#endif
atexit(remove_pidfile);
}