summaryrefslogtreecommitdiff
path: root/cpp/src
diff options
context:
space:
mode:
authorTed Ross <tross@apache.org>2008-06-03 21:46:49 +0000
committerTed Ross <tross@apache.org>2008-06-03 21:46:49 +0000
commitff58985068caca5f20ed22c5a26e65b2961e1ba6 (patch)
tree8b1a51e5e2e23cacb633119cec9023c7a05c3465 /cpp/src
parenteed738de8b03468e05c26be974c835656847e119 (diff)
downloadqpid-python-ff58985068caca5f20ed22c5a26e65b2961e1ba6.tar.gz
Create pid-dir if it does not exist
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@662900 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src')
-rw-r--r--cpp/src/qpid/broker/Daemon.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/cpp/src/qpid/broker/Daemon.cpp b/cpp/src/qpid/broker/Daemon.cpp
index 7f73f764e7..10f48d9e0f 100644
--- a/cpp/src/qpid/broker/Daemon.cpp
+++ b/cpp/src/qpid/broker/Daemon.cpp
@@ -72,8 +72,18 @@ struct LockFile {
} // namespace
Daemon::Daemon(std::string _pidDir) : pidDir(_pidDir) {
+ struct stat s;
pid = -1;
pipeFds[0] = pipeFds[1] = -1;
+
+ if (::stat(pidDir.c_str(), &s)) {
+ if (errno == ENOENT) {
+ if (::mkdir(pidDir.c_str(), 0755))
+ throw Exception ("Can't create PID directory: " + pidDir);
+ }
+ else
+ throw Exception ("PID directory not found: " + pidDir);
+ }
}
string Daemon::pidFile(string pidDir, uint16_t port) {