summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlok Barsode <alokbarsode@gmail.com>2009-03-17 18:56:21 +0530
committerMarcel Holtmann <marcel@holtmann.org>2009-03-14 07:11:47 +0100
commitbf6a4a577408aa6192c40f9a789788badb1a386a (patch)
treeb6fa932a57ea77a02f54e040dc7c78e2a6475d2a /src
parent3f009ea6dfc5bee61a1b4b7b947370584687d131 (diff)
Adding version check for plugins.
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
-rw-r--r--src/plugin.c5
-rw-r--r--src/plugin.h5
3 files changed, 9 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index 3c7d70bb..53034444 100644
--- a/src/main.c
+++ b/src/main.c
@@ -695,7 +695,7 @@ int main(int argc, char *argv[])
umask(0077);
- start_logging("bluetoothd", "Bluetooth daemon");
+ start_logging("bluetoothd", "Bluetooth daemon %s", VERSION);
memset(&sa, 0, sizeof(sa));
sa.sa_flags = SA_NOCLDSTOP;
diff --git a/src/plugin.c b/src/plugin.c
index 4559c77b..051c33c0 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -53,6 +53,11 @@ static gboolean add_plugin(void *handle, struct bluetooth_plugin_desc *desc)
if (desc->init == NULL)
return FALSE;
+ if (g_str_equal(desc->version, VERSION) == FALSE) {
+ DBG("version mismatch for %s", desc->name);
+ return FALSE;
+ }
+
plugin = g_try_new0(struct bluetooth_plugin, 1);
if (plugin == NULL)
return FALSE;
diff --git a/src/plugin.h b/src/plugin.h
index 31bcce87..62d5f758 100644
--- a/src/plugin.h
+++ b/src/plugin.h
@@ -23,13 +23,14 @@
struct bluetooth_plugin_desc {
const char *name;
+ const char *version;
int (*init) (void);
void (*exit) (void);
};
-#define BLUETOOTH_PLUGIN_DEFINE(name,init,exit) \
+#define BLUETOOTH_PLUGIN_DEFINE(name,version,init,exit) \
extern struct bluetooth_plugin_desc bluetooth_plugin_desc \
__attribute__ ((visibility("default"))); \
struct bluetooth_plugin_desc bluetooth_plugin_desc = { \
- name, init, exit \
+ name, version, init, exit \
};