diff options
-rw-r--r-- | hcid/plugin.c | 60 |
1 files changed, 30 insertions, 30 deletions
diff --git a/hcid/plugin.c b/hcid/plugin.c index 46046116..1293e70f 100644 --- a/hcid/plugin.c +++ b/hcid/plugin.c @@ -60,50 +60,50 @@ gboolean plugin_init(void) { GDir *dir; const gchar *file; - gchar *filename; - debug("Loading plugins"); + debug("Loading plugins %s", PLUGINDIR); dir = g_dir_open(PLUGINDIR, 0, NULL); - if (dir != NULL) { - while ((file = g_dir_read_name(dir)) != NULL) { - GModule *module; - struct bluetooth_plugin_desc *desc; - - if (g_str_has_prefix(file, "lib") == FALSE) - continue; + if (!dir) + return FALSE; - filename = g_build_filename(PLUGINDIR, file, NULL); + while ((file = g_dir_read_name(dir)) != NULL) { + GModule *module; + struct bluetooth_plugin_desc *desc; + gchar *filename; - module = g_module_open(filename, 0); - if (module == NULL) { - error("Can't load plugin %s", filename); - continue; - } + if (g_str_has_prefix(file, "lib") == FALSE) + continue; - g_free(filename); + filename = g_build_filename(PLUGINDIR, file, NULL); - debug("%s", g_module_name(module)); + module = g_module_open(filename, 0); + g_free(filename); + if (module == NULL) { + error("Can't load plugin %s", filename); + continue; + } - if (g_module_symbol(module, "bluetooth_plugin_desc", - (gpointer) &desc) == FALSE) { - error("Can't load plugin description"); - g_module_close(module); - continue; - } + debug("%s", g_module_name(module)); - if (desc == NULL || desc->init == NULL) { - g_module_close(module); - continue; - } + if (g_module_symbol(module, "bluetooth_plugin_desc", + (gpointer) &desc) == FALSE) { + error("Can't load plugin description"); + g_module_close(module); + continue; + } - if (add_plugin(module, desc) == FALSE) - g_module_close(module); + if (desc == NULL || desc->init == NULL) { + g_module_close(module); + continue; } - g_dir_close(dir); + if (add_plugin(module, desc) == FALSE) + g_module_close(module); } + g_dir_close(dir); + return TRUE; } |