* FAILED, if the plugin could not be constructed
*/
static status_t create_plugin(private_plugin_loader_t *this, void *handle,
- char *name, bool integrity, bool critical,
- plugin_entry_t **entry)
+ char *name, char *create, bool integrity,
+ bool critical, plugin_entry_t **entry)
{
- char create[128];
plugin_t *plugin;
plugin_constructor_t constructor = NULL;
- if (snprintf(create, sizeof(create), "%s_plugin_create",
- name) >= sizeof(create))
- {
- return FAILED;
- }
- translate(create, "-", "_");
#ifdef STATIC_PLUGIN_CONSTRUCTORS
if (plugin_constructors)
{
static plugin_entry_t *load_plugin(private_plugin_loader_t *this, char *name,
char *file, bool critical)
{
+ char create[128];
plugin_entry_t *entry;
void *handle;
int flag = RTLD_LAZY;
- switch (create_plugin(this, RTLD_DEFAULT, name, FALSE, critical, &entry))
+ if (snprintf(create, sizeof(create), "%s_plugin_create",
+ name) >= sizeof(create))
+ {
+ return NULL;
+ }
+ translate(create, "-", "_");
+ switch (create_plugin(this, RTLD_DEFAULT, name, create, FALSE, critical,
+ &entry))
{
case SUCCESS:
this->plugins->insert_last(this->plugins, entry);
{ /* try to load the plugin from a file */
break;
}
+ DBG1(DBG_LIB, "plugin '%s': failed to load - %s not found and no "
+ "plugin file available", name, create);
/* fall-through */
default:
return NULL;
DBG1(DBG_LIB, "plugin '%s' failed to load: %s", name, dlerror());
return NULL;
}
- if (create_plugin(this, handle, name, TRUE, critical, &entry) != SUCCESS)
+ switch (create_plugin(this, handle, name, create, TRUE, critical, &entry))
{
- dlclose(handle);
- return NULL;
+ case SUCCESS:
+ break;
+ case NOT_FOUND:
+ DBG1(DBG_LIB, "plugin '%s': failed to load - %s not found", name,
+ create);
+ /* fall-through */
+ default:
+ dlclose(handle);
+ return NULL;
}
entry->handle = handle;
this->plugins->insert_last(this->plugins, entry);