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/DataDir.cpp | |
| 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/DataDir.cpp')
| -rw-r--r-- | cpp/src/qpid/DataDir.cpp | 14 |
1 files changed, 10 insertions, 4 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))); } |
