summaryrefslogtreecommitdiff
path: root/src/modulemanager.cpp
diff options
context:
space:
mode:
authorAdam <Adam@anope.org>2010-09-17 19:20:07 -0400
committerAdam <Adam@anope.org>2010-09-17 19:20:07 -0400
commit227909e2cf0039737dc52872651837fe5f1702b5 (patch)
treeb8a7072c7d938ea66d9710a48d717b3eb76343de /src/modulemanager.cpp
parentf71fb6e8133da955a58b1cca00013ce20c0b65cc (diff)
Rejig of some of the socket stuff. Fixed marking sockets as nonblocking on Windows. Added in a LastError function to keep having to use strerror/GetLastError everywhere.
Diffstat (limited to 'src/modulemanager.cpp')
-rw-r--r--src/modulemanager.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/modulemanager.cpp b/src/modulemanager.cpp
index dc1258340..8e4329581 100644
--- a/src/modulemanager.cpp
+++ b/src/modulemanager.cpp
@@ -134,8 +134,8 @@ int ModuleManager::LoadModule(const Anope::string &modname, User *u)
ano_modclearerr();
ano_module_t handle = dlopen(pbuf.c_str(), RTLD_LAZY);
- const char *err;
- if (!handle && (err = dlerror()))
+ const char *err = ano_moderr();
+ if (!handle && err && *err)
{
Log() << err;
return MOD_ERR_NOLOAD;
@@ -143,7 +143,8 @@ int ModuleManager::LoadModule(const Anope::string &modname, User *u)
ano_modclearerr();
Module *(*func)(const Anope::string &, const Anope::string &) = function_cast<Module *(*)(const Anope::string &, const Anope::string &)>(dlsym(handle, "AnopeInit"));
- if (!func && (err = dlerror()))
+ err = ano_moderr();
+ if (!func && err && *err)
{
Log() << "No init function found, not an Anope module";
dlclose(handle);
@@ -257,8 +258,8 @@ void ModuleManager::DeleteModule(Module *m)
ano_modclearerr();
void (*destroy_func)(Module *m) = function_cast<void (*)(Module *)>(dlsym(m->handle, "AnopeFini"));
- const char *err;
- if (!destroy_func && (err = dlerror()))
+ const char *err = ano_moderr();
+ if (!destroy_func && err && *err)
{
Log() << "No destroy function found, chancing delete...";
delete m; /* we just have to chance they haven't overwrote the delete operator then... */
@@ -269,7 +270,7 @@ void ModuleManager::DeleteModule(Module *m)
if (handle)
{
if (dlclose(handle))
- Log() << dlerror();
+ Log() << ano_moderr();
}
if (!filename.empty())