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>
+ 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)() =