From 0d2ed5bfcb127e68bc695eeeadd8751f7f8a4d7a Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Tue, 1 Apr 2008 13:58:42 +0000 Subject: Unload plugins which fails to init. --- hcid/plugin.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hcid/plugin.c b/hcid/plugin.c index 2a15741e..847bf5e6 100644 --- a/hcid/plugin.c +++ b/hcid/plugin.c @@ -46,6 +46,9 @@ static gboolean add_plugin(GModule *module, struct bluetooth_plugin_desc *desc) { struct bluetooth_plugin *plugin; + if (desc->init() < 0) + return FALSE; + plugin = g_try_new0(struct bluetooth_plugin, 1); if (plugin == NULL) return FALSE; @@ -55,8 +58,6 @@ static gboolean add_plugin(GModule *module, struct bluetooth_plugin_desc *desc) plugins = g_slist_append(plugins, plugin); - desc->init(); - return TRUE; } @@ -113,8 +114,10 @@ gboolean plugin_init(void) continue; } - if (add_plugin(module, desc) == FALSE) + if (add_plugin(module, desc) == FALSE) { + error("Can't init plugin %s", g_module_name(module)); g_module_close(module); + } } g_dir_close(dir); -- cgit