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

@@ -32,6 +32,10 @@
*
* @endcond
*/
#if LL_LINUX
#include <dlfcn.h>
#include <apr_portable.h>
#endif
#include "linden_common.h"
@@ -83,16 +87,25 @@ int LLPluginInstance::load(std::string &plugin_file)
{
pluginInitFunction init_function = NULL;
#if LL_LINUX
void *dso_handle = dlopen(plugin_file.c_str(), RTLD_NOW | RTLD_GLOBAL);
int result = (!dso_handle)?APR_EDSOOPEN:apr_os_dso_handle_put(&mDSOHandle,
dso_handle, AIAPRRootPool::get()());
#else
int result = apr_dso_load(&mDSOHandle,
plugin_file.c_str(),
AIAPRRootPool::get()());
#endif
if(result != APR_SUCCESS)
{
char buf[1024];
apr_dso_error(mDSOHandle, buf, sizeof(buf));
#if LL_LINUX
LL_WARNS("Plugin") << "plugin load " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL;
#else
LL_WARNS("Plugin") << "apr_dso_load of " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL;
#endif
}
if(result == APR_SUCCESS)