diff options
| author | Ted Ross <tross@apache.org> | 2008-06-03 18:19:29 +0000 |
|---|---|---|
| committer | Ted Ross <tross@apache.org> | 2008-06-03 18:19:29 +0000 |
| commit | 7631a5f411f40396364abefd4e7b9b381f857db0 (patch) | |
| tree | 3e31137d5abbde22e8bf29f5b4172287af6f6cb6 /cpp/src/qpid | |
| parent | f081132e845b3ae92aa08ef3996ec29a2f6de2ed (diff) | |
| download | qpid-python-7631a5f411f40396364abefd4e7b9b381f857db0.tar.gz | |
QPID-1114 Change defaults for data-dir and pid-dir to /home/ross/.qpidd
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@662854 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid')
| -rw-r--r-- | cpp/src/qpid/DataDir.cpp | 14 | ||||
| -rw-r--r-- | cpp/src/qpid/broker/Broker.cpp | 9 |
2 files changed, 18 insertions, 5 deletions
diff --git a/cpp/src/qpid/DataDir.cpp b/cpp/src/qpid/DataDir.cpp index 5fa26082b3..e9c6aaad53 100644 --- a/cpp/src/qpid/DataDir.cpp +++ b/cpp/src/qpid/DataDir.cpp @@ -41,8 +41,14 @@ DataDir::DataDir (std::string path) : const char *cpath = dirPath.c_str (); struct stat s; - if (::stat (cpath, &s)) - throw Exception ("Data directory not found: " + path); + if (::stat(cpath, &s)) { + if (errno == ENOENT) { + if (::mkdir(cpath, 0755)) + throw Exception ("Can't create data directory: " + path); + } + else + throw Exception ("Data directory not found: " + path); + } std::string lockFile (path); lockFile = lockFile + "/lock"; @@ -51,9 +57,9 @@ DataDir::DataDir (std::string path) : if (fd == -1) { if (errno == EEXIST) - throw Exception ("Data directory is locked by another process"); + throw Exception ("Data directory is locked by another process: " + path); if (errno == EACCES) - throw Exception ("Insufficient privileges for data directory"); + throw Exception ("Insufficient privileges for data directory: " + path); throw Exception( QPID_MSG("Error locking " << lockFile << ": " << strError(errno))); } diff --git a/cpp/src/qpid/broker/Broker.cpp b/cpp/src/qpid/broker/Broker.cpp index 2992ea45cf..4636b94371 100644 --- a/cpp/src/qpid/broker/Broker.cpp +++ b/cpp/src/qpid/broker/Broker.cpp @@ -76,7 +76,6 @@ namespace broker { Broker::Options::Options(const std::string& name) : qpid::Options(name), noDataDir(0), - dataDir("/var/lib/qpidd"), port(DEFAULT_PORT), workerThreads(5), maxConnections(500), @@ -90,6 +89,14 @@ Broker::Options::Options(const std::string& name) : { int c = sys::SystemInfo::concurrency(); workerThreads=c+1; + char *home = ::getenv("HOME"); + + if (home == 0) + home = "/tmp"; + + dataDir += home; + dataDir += "/.qpidd"; + addOptions() ("data-dir", optValue(dataDir,"DIR"), "Directory to contain persistent data generated by the broker") ("no-data-dir", optValue(noDataDir), "Don't use a data directory. No persistent configuration will be loaded or stored") |
