X-Git-Url: https://vcs.maemo.org/git/?a=blobdiff_plain;f=src%2Fplugin.c;h=7fb7d444b2e328f8cd5a234e3967bc0e9fa37907;hb=refs%2Ftags%2F0.7;hp=cfbd906ace35081dd3f4a16c864dc53336d6d12f;hpb=0889675fe72fdedfd0f8919084d80a550d6b3472;p=connman diff --git a/src/plugin.c b/src/plugin.c index cfbd906..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,15 +53,17 @@ static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc) plugin->handle = handle; plugin->desc = desc; - if (desc->init() < 0) + if (desc->init() < 0) { + g_free(plugin); return FALSE; + } 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; @@ -92,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; }