mirror of
https://github.com/anope/anope.git
synced 2026-06-27 14:46:38 +02:00
Squashed commit: merge next (1.9.1) back to trunk.
SVN users, NOTE: THIS WILL NOT BUILD, NOR SHOULD YOU RUN IT YET. git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@1953 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
@@ -170,19 +170,19 @@ int ModuleManager::LoadModule(const std::string &modname, User * u)
|
||||
|
||||
ano_modclearerr();
|
||||
|
||||
ano_module_t handle = ano_modopen(pbuf.c_str());
|
||||
if (handle == NULL && (err = ano_moderr()) != NULL)
|
||||
ano_module_t handle = dlopen(pbuf.c_str(), RTLD_LAZY);
|
||||
if (handle == NULL && (err = dlerror()) != NULL)
|
||||
{
|
||||
alog("%s", err);
|
||||
return MOD_ERR_NOLOAD;
|
||||
}
|
||||
|
||||
ano_modclearerr();
|
||||
func = function_cast<Module *(*)(const std::string &)>(ano_modsym(handle, "init_module"));
|
||||
if (func == NULL && (err = ano_moderr()) != NULL)
|
||||
func = function_cast<Module *(*)(const std::string &)>(dlsym(handle, "init_module"));
|
||||
if (func == NULL && (err = dlerror()) != NULL)
|
||||
{
|
||||
alog("No magical init function found, not an Anope module");
|
||||
ano_modclose(handle);
|
||||
dlclose(handle);
|
||||
return MOD_ERR_NOLOAD;
|
||||
}
|
||||
|
||||
@@ -275,8 +275,8 @@ void ModuleManager::DeleteModule(Module *m)
|
||||
handle = m->handle;
|
||||
|
||||
ano_modclearerr();
|
||||
destroy_func = function_cast<void (*)(Module *)>(ano_modsym(m->handle, "destroy_module"));
|
||||
if (destroy_func == NULL && (err = ano_moderr()) != NULL)
|
||||
destroy_func = function_cast<void (*)(Module *)>(dlsym(m->handle, "destroy_module"));
|
||||
if (destroy_func == NULL && (err = dlerror()) != NULL)
|
||||
{
|
||||
alog("No magical destroy function found, chancing delete...");
|
||||
delete m; /* we just have to chance they haven't overwrote the delete operator then... */
|
||||
@@ -288,7 +288,7 @@ void ModuleManager::DeleteModule(Module *m)
|
||||
|
||||
if (handle)
|
||||
{
|
||||
if ((ano_modclose(handle)) != 0)
|
||||
alog("%s", ano_moderr());
|
||||
if ((dlclose(handle)) != 0)
|
||||
alog("%s", dlerror());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user