Skip to content

Commit

Permalink
common/PluginRegistry: try $plugin_dir/$foo if $plugin_dir/$type/$foo…
Browse files Browse the repository at this point in the history
… fails

This is helpful for running out of a build dir, where e.g. cmake puts
stuff in lib/* and type separated into subdirs by type.

Signed-off-by: Sage Weil <sage@redhat.com>
  • Loading branch information
liewegas committed Jun 30, 2016
1 parent 6732ef0 commit 42c640e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/common/PluginRegistry.cc
Expand Up @@ -142,9 +142,15 @@ int PluginRegistry::load(const std::string &type,
+ name + PLUGIN_SUFFIX;
void *library = dlopen(fname.c_str(), RTLD_NOW);
if (!library) {
lderr(cct) << __func__ << " failed dlopen(" << fname << "): "
<< dlerror() << dendl;
return -EIO;
// 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;
return -EIO;
}
}

const char * (*code_version)() =
Expand Down

0 comments on commit 42c640e

Please sign in to comment.