diff options
| author | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-04-01 13:58:42 +0000 | 
|---|---|---|
| committer | Luiz Augusto von Dentz <luiz.dentz@openbossa.org> | 2008-04-01 13:58:42 +0000 | 
| commit | 0d2ed5bfcb127e68bc695eeeadd8751f7f8a4d7a (patch) | |
| tree | b8fb6094730ba0b2bb952840d39b34b1f245be88 | |
| parent | 569bf626da21398648b849e2f4dfc0c1b2962fa5 (diff) | |
Unload plugins which fails to init.
| -rw-r--r-- | hcid/plugin.c | 9 | 
1 files 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); | 
