From 7631a5f411f40396364abefd4e7b9b381f857db0 Mon Sep 17 00:00:00 2001 From: Ted Ross Date: Tue, 3 Jun 2008 18:19:29 +0000 Subject: 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 --- cpp/src/qpid/DataDir.cpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'cpp/src/qpid/DataDir.cpp') 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))); } -- cgit v1.2.1