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.
This commit is contained in:
@@ -380,7 +380,15 @@ static plugin_entry_t *load_plugin(private_plugin_loader_t *this, char *name,
|
|||||||
return NULL;
|
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)
|
if (handle == NULL)
|
||||||
{
|
{
|
||||||
DBG1(DBG_LIB, "plugin '%s' failed to load: %s", name, dlerror());
|
DBG1(DBG_LIB, "plugin '%s' failed to load: %s", name, dlerror());
|
||||||
|
|||||||
Reference in New Issue
Block a user