summaryrefslogtreecommitdiff
path: root/qpid/cpp/src
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/src')
-rw-r--r--qpid/cpp/src/qpid/Modules.cpp29
-rw-r--r--qpid/cpp/src/qpid/sys/posix/Shlib.cpp2
-rw-r--r--qpid/cpp/src/qpidd.cpp1
3 files changed, 20 insertions, 12 deletions
diff --git a/qpid/cpp/src/qpid/Modules.cpp b/qpid/cpp/src/qpid/Modules.cpp
index 7230630818..70549bd553 100644
--- a/qpid/cpp/src/qpid/Modules.cpp
+++ b/qpid/cpp/src/qpid/Modules.cpp
@@ -30,6 +30,21 @@
namespace fs=boost::filesystem;
+namespace {
+
+// CMake sets QPID_MODULE_SUFFIX; Autoconf doesn't, so assume Linux .so
+#if defined (QPID_MODULE_SUFFIX)
+ std::string suffix(QPID_MODULE_SUFFIX);
+#else
+ std::string suffix(".so");
+#endif
+
+bool isShlibName(const std::string& name) {
+ return name.find (suffix) == name.length() - suffix.length();
+}
+
+}
+
namespace qpid {
ModuleOptions::ModuleOptions(const std::string& defaultModuleDir)
@@ -41,7 +56,9 @@ ModuleOptions::ModuleOptions(const std::string& defaultModuleDir)
("no-module-dir", optValue(noLoad), "Don't load modules from module directory");
}
-void tryShlib(const char* libname, bool noThrow) {
+void tryShlib(const char* libname_, bool noThrow) {
+ std::string libname(libname_);
+ if (!isShlibName(libname)) libname += suffix;
try {
sys::Shlib shlib(libname);
QPID_LOG (info, "Loaded Module: " << libname);
@@ -68,17 +85,9 @@ void loadModuleDir (std::string dirname, bool isDefault)
}
fs::directory_iterator endItr;
- // CMake sets QPID_MODULE_SUFFIX; Autoconf doesn't, so assume Linux .so
-#if defined (QPID_MODULE_SUFFIX)
- std::string suffix(QPID_MODULE_SUFFIX);
-#else
- std::string suffix(".so");
-#endif
for (fs::directory_iterator itr (dirPath); itr != endItr; ++itr)
{
- if (!fs::is_directory(*itr) &&
- itr->string().find (suffix) ==
- itr->string().length() - suffix.length())
+ if (!fs::is_directory(*itr) && isShlibName(itr->string()))
tryShlib (itr->string().data(), true);
}
}
diff --git a/qpid/cpp/src/qpid/sys/posix/Shlib.cpp b/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
index 62dbfb3dd9..299331103c 100644
--- a/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
+++ b/qpid/cpp/src/qpid/sys/posix/Shlib.cpp
@@ -27,7 +27,7 @@ namespace qpid {
namespace sys {
void Shlib::load(const char* name) {
- dlerror();
+ ::dlerror();
handle = ::dlopen(name, RTLD_NOW);
const char* error = ::dlerror();
if (error) {
diff --git a/qpid/cpp/src/qpidd.cpp b/qpid/cpp/src/qpidd.cpp
index f2b46942fb..a7c1dbe8a6 100644
--- a/qpid/cpp/src/qpidd.cpp
+++ b/qpid/cpp/src/qpidd.cpp
@@ -24,7 +24,6 @@
#include "qpid/Version.h"
#include "qpid/log/Logger.h"
#include "qpid/log/Statement.h"
-#include "qpid/sys/Shlib.h"
#include <iostream>
#include <memory>