respondd: add diagnostics about failed module load

This commit is contained in:
Thomas Weißschuh 2017-09-26 17:19:40 +00:00
parent ad8918376e
commit 90ccec1b31
1 changed files with 9 additions and 1 deletions

View File

@ -183,11 +183,19 @@ static const struct respondd_provider_info * get_providers(const char *filename)
snprintf(path, sizeof(path), "./%s", filename);
void *handle = dlopen(path, RTLD_NOW|RTLD_LOCAL);
if (!handle)
if (!handle) {
syslog(LOG_WARNING, "unable to open provider module '%s', ignoring: %s", filename, dlerror());
return NULL;
}
// clean a potential previous error
dlerror();
const struct respondd_provider_info *ret = dlsym(handle, "respondd_providers");
if (!ret) {
syslog(LOG_WARNING,
"unable to load providers from '%s', ignoring: %s",
filename, dlerror() ?: "'respondd_providers' == NULL");
dlclose(handle);
return NULL;
}