aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/plugin_loader.c
diff options
context:
space:
mode:
authorMartin Willi <martin@revosec.ch>2015-02-24 11:50:21 +0100
committerMartin Willi <martin@revosec.ch>2015-02-24 12:25:01 +0100
commit20a0fd9255540f669e6adeccc7af60872f95ee18 (patch)
tree044095703e58e7477c2cce28796dc979b0618476 /src/libstrongswan/plugins/plugin_loader.c
parent67a9744bb940f4ba30ef43d22d891757051a11aa (diff)
downloadstrongswan-20a0fd9255540f669e6adeccc7af60872f95ee18.tar.bz2
strongswan-20a0fd9255540f669e6adeccc7af60872f95ee18.tar.xz
plugin-loader: Do not unload libraries during dlclose(), if supported
Unloading libraries calls any library constructor/destructor functions. Some libraries can't handle that in our excessive unit test use. GnuTLS leaks a /dev/urandom file descriptor, letting unit tests fail with arbitrary out-of-resources errors.
Diffstat (limited to 'src/libstrongswan/plugins/plugin_loader.c')
-rw-r--r--src/libstrongswan/plugins/plugin_loader.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/libstrongswan/plugins/plugin_loader.c b/src/libstrongswan/plugins/plugin_loader.c
index 1fec1b3ea..84ff88fc3 100644
--- a/src/libstrongswan/plugins/plugin_loader.c
+++ b/src/libstrongswan/plugins/plugin_loader.c
@@ -380,7 +380,15 @@ static plugin_entry_t *load_plugin(private_plugin_loader_t *this, char *name,
return NULL;
}
}
- handle = dlopen(file, RTLD_LAZY);
+ handle = dlopen(file, RTLD_LAZY
+#ifdef RTLD_NODELETE
+ /* if supported, do not unload library when unloading a plugin. It really
+ * doesn't matter in productive systems, but causes many (dependency)
+ * library reloads during unit tests. Some libraries can't handle that,
+ * GnuTLS leaks file descriptors in its library load/unload functions. */
+ | RTLD_NODELETE
+#endif
+ );
if (handle == NULL)
{
DBG1(DBG_LIB, "plugin '%s' failed to load: %s", name, dlerror());