summaryrefslogtreecommitdiff
path: root/src/plugin.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2009-05-26 13:32:18 +0200
committerMarcel Holtmann <marcel@holtmann.org>2009-05-26 13:32:18 +0200
commitd37c84fb73cd705e0aceb06a701b764c9be0ebed (patch)
treec5f2a9ebb539300a41fe744498e7eb455e8e8a4d /src/plugin.c
parent8efc7bf52f66a144875a5d32548d496431a78360 (diff)
downloadconnman-d37c84fb73cd705e0aceb06a701b764c9be0ebed.tar.gz
connman-d37c84fb73cd705e0aceb06a701b764c9be0ebed.tar.bz2
connman-d37c84fb73cd705e0aceb06a701b764c9be0ebed.zip
Add workaround for broken libraries within plugins
Diffstat (limited to 'src/plugin.c')
-rw-r--r--src/plugin.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/plugin.c b/src/plugin.c
index e5e24647..6268652d 100644
--- a/src/plugin.c
+++ b/src/plugin.c
@@ -33,6 +33,17 @@
#include "connman.h"
+/*
+ * Plugins that are using libraries with threads and their own mainloop
+ * will crash on exit. This is a bug inside these libraries, but there is
+ * nothing much that can be done about it.
+ */
+#ifdef NEED_THREADS
+#define PLUGINFLAG (RTLD_NOW | RTLD_NODELETE)
+#else
+#define PLUGINFLAG (RTLD_NOW)
+#endif
+
static GSList *plugins = NULL;
struct connman_plugin {
@@ -124,7 +135,7 @@ int __connman_plugin_init(const char *pattern, const char *exclude)
filename = g_build_filename(PLUGINDIR, file, NULL);
- handle = dlopen(filename, RTLD_NOW);
+ handle = dlopen(filename, PLUGINFLAG);
if (handle == NULL) {
connman_error("Can't load %s: %s",
filename, dlerror());