Author: kpvdr
Date: Tue Nov 25 20:39:38 2014
New Revision: 1641689

URL: http://svn.apache.org/r1641689
Log:
QPID-6248 [linearstore] Symlink creation fails if store dir path is not absolute

Modified:
    qpid/trunk/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp
    qpid/trunk/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp

Modified: qpid/trunk/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp?rev=1641689&r1=1641688&r2=1641689&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/linearstore/MessageStoreImpl.cpp Tue Nov 25 
20:39:38 2014
@@ -203,7 +203,7 @@ bool MessageStoreImpl::init(const std::s
         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)");

Modified: qpid/trunk/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp
URL: 
http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp?rev=1641689&r1=1641688&r2=1641689&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp (original)
+++ qpid/trunk/qpid/cpp/src/qpid/linearstore/StorePlugin.cpp Tue Nov 25 
20:39:38 2014
@@ -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);



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to