From 3a6b635f21713722e5f04c27af60f315c3171839 Mon Sep 17 00:00:00 2001 From: Igor Fedotov Date: Wed, 14 Sep 2016 15:27:05 +0000 Subject: [PATCH] common/PluginRegistry: improve error output forshared library load failure. Signed-off-by: Igor Fedotov --- src/common/PluginRegistry.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/common/PluginRegistry.cc b/src/common/PluginRegistry.cc index 661df1c74e5..bbaadd81001 100644 --- a/src/common/PluginRegistry.cc +++ b/src/common/PluginRegistry.cc @@ -142,13 +142,16 @@ int PluginRegistry::load(const std::string &type, + name + PLUGIN_SUFFIX; void *library = dlopen(fname.c_str(), RTLD_NOW); if (!library) { + string err1(dlerror()); // fall back to plugin_dir std::string fname2 = cct->_conf->plugin_dir + "/" + PLUGIN_PREFIX + name + PLUGIN_SUFFIX; library = dlopen(fname2.c_str(), RTLD_NOW); if (!library) { - lderr(cct) << __func__ << " failed dlopen(" << fname << ") or dlopen(" - << fname2 << "): " << dlerror() << dendl; + lderr(cct) << __func__ + << " failed dlopen(): \"" << err1.c_str() + << "\" or \"" << dlerror() << "\"" + << dendl; return -EIO; } } -- 2.47.3