summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
authorKim van der Riet <kpvdr@apache.org>2014-11-25 20:39:38 +0000
committerKim van der Riet <kpvdr@apache.org>2014-11-25 20:39:38 +0000
commitb0ebd6a99b5bbd579b5b823cda2bc851e93407b8 (patch)
tree283b15a1991dcb66edb9c6604b1b830bd3074825 /qpid/cpp
parent98b855eb7a84898a80155dcc8ab0345821db9bd8 (diff)
downloadqpid-python-b0ebd6a99b5bbd579b5b823cda2bc851e93407b8.tar.gz
QPID-6248 [linearstore] Symlink creation fails if store dir path is not absolute
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1641689 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp2
-rw-r--r--qpid/cpp/src/qpid/linearstore/StorePlugin.cpp15
2 files changed, 16 insertions, 1 deletions
diff --git a/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp b/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp
index a5dd63da62..77d5703636 100644
--- a/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp
+++ b/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp
@@ -203,7 +203,7 @@ bool MessageStoreImpl::init(const std::string& storeDir_,
truncateInit();
init(truncateFlag_);
- QLS_LOG(info, "Store module initialized; store-dir=" << storeDir_);
+ QLS_LOG(notice, "Store module initialized; store-dir=" << storeDir_);
QLS_LOG(info, "> Default EFP partition: " << defaultEfpPartitionNumber);
QLS_LOG(info, "> Default EFP file size: " << defaultEfpFileSize_kib << " (KiB)");
QLS_LOG(info, "> Default write cache page size: " << wCachePageSizeKib_ << " (KiB)");
diff --git a/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp b/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp
index d64b44b5e3..cd8c7ed8a3 100644
--- a/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp
+++ b/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp
@@ -53,6 +53,21 @@ struct StorePlugin : public Plugin {
throw Exception ("linearstore: If broker option --data-dir is blank or --no-data-dir is specified, linearstore option --store-dir must be present.");
options.storeDir = dataDir.getPath ();
+ } else {
+ // Check if store dir is absolute. If not, make it absolute using qpidd executable dir as base
+ if (options.storeDir.at(0) != '/') {
+ char buf[1024];
+ if (::getcwd(buf, sizeof(buf)-1) == 0) {
+ std::ostringstream oss;
+ oss << "linearstore: getcwd() unable to read current directory: errno=" << errno << " (" << strerror(errno) << ")";
+ throw Exception(oss.str());
+ }
+ std::string newStoreDir = std::string(buf) + "/" + options.storeDir;
+ std::ostringstream oss;
+ oss << "store-dir option \"" << options.storeDir << "\" is not absolute, changed to \"" << newStoreDir << "\"";
+ QLS_LOG(warning, oss.str());
+ options.storeDir = newStoreDir;
+ }
}
store->init(&options);
boost::shared_ptr<qpid::broker::MessageStore> brokerStore(store);