diff options
Diffstat (limited to 'cpp/src/windows/QpiddBroker.cpp')
| -rw-r--r-- | cpp/src/windows/QpiddBroker.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/cpp/src/windows/QpiddBroker.cpp b/cpp/src/windows/QpiddBroker.cpp index a22ccba63f..5c6eef48f8 100644 --- a/cpp/src/windows/QpiddBroker.cpp +++ b/cpp/src/windows/QpiddBroker.cpp @@ -223,6 +223,17 @@ int QpiddBroker::execute (QpiddOptions *options) { options->broker.port = brokerPtr->getPort(""); std::cout << options->broker.port << std::endl; + // Make sure the pid directory exists, creating if needed. LockFile + // will throw an exception that makes little sense if it can't create + // the file. + if (!CreateDirectory(myOptions->control.piddir.c_str(), 0)) { + DWORD err = GetLastError(); + if (err != ERROR_ALREADY_EXISTS) + throw qpid::Exception(QPID_MSG("Can't create pid-dir " + + myOptions->control.piddir + + ": " + + qpid::sys::strError(err))); + } qpid::sys::LockFile myPid(brokerPidFile(myOptions->control.piddir, options->broker.port), true); |
