From 681cdd4a0c0bf186b9a0cca012992e8d654fd4ca Mon Sep 17 00:00:00 2001 From: Marcel Holtmann Date: Wed, 7 Jan 2009 17:03:51 +0100 Subject: [PATCH] Only load plugins with the same version string --- doc/plugin-api.txt | 2 +- include/plugin.h | 2 +- include/version.h.in | 2 +- src/plugin.c | 3 +++ 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/doc/plugin-api.txt b/doc/plugin-api.txt index e329ced..696e2c1 100644 --- a/doc/plugin-api.txt +++ b/doc/plugin-api.txt @@ -20,5 +20,5 @@ static void example_exit(void) { } -CONNMAN_PLUGIN_DEFINE(example, "Example plugin", VERSION, +CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION, example_init, example_exit) diff --git a/include/plugin.h b/include/plugin.h index d538dc7..84e0958 100644 --- a/include/plugin.h +++ b/include/plugin.h @@ -69,7 +69,7 @@ struct connman_plugin_desc { * { * } * - * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", VERSION, + * CONNMAN_PLUGIN_DEFINE(example, "Example plugin", CONNMAN_VERSION, * example_init, example_exit) * ]| */ diff --git a/include/version.h.in b/include/version.h.in index c163f8a..5d44396 100644 --- a/include/version.h.in +++ b/include/version.h.in @@ -26,7 +26,7 @@ extern "C" { #endif -#define CONNMAN_VERSION @VERSION@ +#define CONNMAN_VERSION "@VERSION@" #ifdef __cplusplus } diff --git a/src/plugin.c b/src/plugin.c index 2103b66..7fb7d44 100644 --- a/src/plugin.c +++ b/src/plugin.c @@ -43,6 +43,9 @@ static gboolean add_plugin(void *handle, struct connman_plugin_desc *desc) 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; -- 2.7.4