diff options
author | Stephen D. Huston <shuston@apache.org> | 2009-08-05 17:17:30 +0000 |
---|---|---|
committer | Stephen D. Huston <shuston@apache.org> | 2009-08-05 17:17:30 +0000 |
commit | 4b5a66d78efd8e9bed92a68ceb6eb49cbd7cc292 (patch) | |
tree | 6ab4e2df788ea97f0401ccbb58746d0cefceb518 /cpp/src/windows/QpiddBroker.cpp | |
parent | 6a88411f3a2f01c1992e86dc5cfada1d87a7f940 (diff) | |
download | qpid-python-4b5a66d78efd8e9bed92a68ceb6eb49cbd7cc292.tar.gz |
Try to create piddir if needed; on error throw a useful message. Fixes QPID-2030
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@801315 13f79535-47bb-0310-9956-ffa450edef68
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); |