diff options
author | Ted Ross <tross@apache.org> | 2008-06-03 21:46:49 +0000 |
---|---|---|
committer | Ted Ross <tross@apache.org> | 2008-06-03 21:46:49 +0000 |
commit | 08abbdf35999a36d2df84aedff34e1abc6eded13 (patch) | |
tree | 78f868b9105fc48b1ebb35613c33eba5e2669b25 /qpid/cpp/src | |
parent | 9e9e414096506b972901b7f08b945250c69f3ad5 (diff) | |
download | qpid-python-08abbdf35999a36d2df84aedff34e1abc6eded13.tar.gz |
Create pid-dir if it does not exist
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@662900 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r-- | qpid/cpp/src/qpid/broker/Daemon.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/broker/Daemon.cpp b/qpid/cpp/src/qpid/broker/Daemon.cpp index 7f73f764e7..10f48d9e0f 100644 --- a/qpid/cpp/src/qpid/broker/Daemon.cpp +++ b/qpid/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) { |