Fix a problem not letting plugins work when the client is built on RedHat and derived systems (Fedora is affected too). Completely avoid apr_dso_load() on Linux (they modified it to open libraries with RTLD_NOW | RTLD_GLOBAL | RTLD_DEEPBIND). Get a standard DSO handle with RTLD_NOW | RTLD_GLOBAL flags instead, and convert it to a valid APR one by using apr_os_handle_put().

This commit is contained in:
Player Dagostino
2011-08-02 20:15:58 +02:00
parent f3d6931fc3
commit a45de10024
5 changed files with 42 additions and 7 deletions

View File

@@ -28,6 +28,11 @@
* COMPLETENESS OR PERFORMANCE.
* $/LicenseInfo$
*/
#if LL_LINUX
#include <dlfcn.h>
#include <apr_portable.h>
#endif
#include "linden_common.h"
#include "apr_pools.h"
@@ -85,9 +90,15 @@ void LLImageJ2C::openDSO()
j2cimpl_dso_memory_pool.create();
//attempt to load the shared library
#if LL_LINUX
void *dso_handle = dlopen(dso_path.c_str(), RTLD_NOW | RTLD_GLOBAL);
rv = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&j2cimpl_dso_handle,
dso_handle, j2cimpl_dso_memory_pool());
#else
rv = apr_dso_load(&j2cimpl_dso_handle,
dso_path.c_str(),
j2cimpl_dso_memory_pool());
#endif
//now, check for success
if ( rv == APR_SUCCESS )