Print useful error when dlopen() return NULL on linux standalone.

This commit is contained in:
Aleric Inglewood
2012-06-04 23:45:17 +02:00
parent c02834b7e3
commit 782091ff02
2 changed files with 17 additions and 2 deletions

View File

@@ -99,7 +99,22 @@ int LLPluginInstance::load(std::string &plugin_file)
if(result != APR_SUCCESS)
{
char buf[1024];
apr_dso_error(mDSOHandle, buf, sizeof(buf));
#if LL_LINUX && defined(LL_STANDALONE)
if (!dso_handle)
{
char* error = dlerror();
buf[0] = 0;
if (error)
{
strncpy(buf, dlerror(), sizeof(buf));
}
buf[sizeof(buf) - 1] = 0;
}
else
#endif
{
apr_dso_error(mDSOHandle, buf, sizeof(buf));
}
#if LL_LINUX && defined(LL_STANDALONE)
LL_WARNS("Plugin") << "plugin load " << plugin_file << " failed with error " << result << " , additional info string: " << buf << LL_ENDL;

View File

@@ -191,7 +191,7 @@ int main(int argc, char **argv)
#ifdef CWDEBUG
Debug( libcw_do.margin().assign("SLPlugin ", 9) );
Debug(debug::init());
// Uncomment this to automatically open a terminal with gdb. Requires SNOW-173.
// Uncomment this to automatically open a terminal with gdb.
//Debug(attach_gdb());
#endif