X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplugin.c;h=7fb7d444b2e328f8cd5a234e3967bc0e9fa37907;hb=refs%2Ftags%2F0.7;hp=0d90fd9fbc36337d8c1320421ec35520db9fc821;hpb=0af74f53a3dfd5d4aa93326d5900b8562b019687;p=connman diff --git a/src/plugin.c b/src/plugin.c index 0d90fd9..7fb7d44 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -2,7 +2,7 @@ * * Connection Manager * - * Copyright (C) 2007-2008 Intel Corporation. All rights reserved. + * Copyright (C) 2007-2009 Intel Corporation. All rights reserved. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as @@ -40,6 +40,12 @@ static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc) { struct connman_plugin *plugin; + if (desc->init == NULL) + return FALSE; + + if (g_str_equal(desc->version, CONNMAN_VERSION) == FALSE) + return FALSE; + plugin = g_try_new0(struct connman_plugin, 1); if (plugin == NULL) return FALSE; @@ -47,14 +53,17 @@ static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc) plugin->handle = handle; plugin->desc = desc; - plugins = g_slist_append(plugins, plugin); + if (desc->init() < 0) { + g_free(plugin); + return FALSE; + } - desc->init(); + plugins = g_slist_append(plugins, plugin); return TRUE; } -int __connman_plugin_init(void) +int __connman_plugin_init(const char *pattern) { GDir *dir; const gchar *file; @@ -91,7 +100,9 @@ int __connman_plugin_init(void) continue; } - if (desc->init == NULL) { + if (pattern != NULL && g_pattern_match_simple(pattern, + desc->name) == FALSE) { + DBG("ignoring %s", desc->description); dlclose(handle); continue; }