summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-07 20:42:18 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-07 20:42:18 +0000
commit233402b05c036aeb396af6ee27bf43f7405adb97 (patch)
tree61a4cddc05b8f814aa8bedd9436d0403d764ae31 /src
parent7548a18e4c2fa474ec4bd370c483bd991fafaa00 (diff)
The segfaults on missing init_module symbol are now gone, and hopefully not coming back!
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4772 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/dynamic.cpp21
-rw-r--r--src/inspircd.cpp3
-rw-r--r--src/modules/m_devoice.cpp2
3 files changed, 8 insertions, 18 deletions
diff --git a/src/dynamic.cpp b/src/dynamic.cpp
index 778a94521..ebb1ee71c 100644
--- a/src/dynamic.cpp
+++ b/src/dynamic.cpp
@@ -64,7 +64,7 @@ DLLManager::DLLManager(const char *fname)
// a little safer if the ircd is running at the time as the
// shared libraries are mmap()ed and not doing this causes
// segfaults.
- /*FILE* x = fopen(fname,"rb");
+ FILE* x = fopen(fname,"rb");
if (!x)
{
err = strerror(errno);
@@ -102,7 +102,7 @@ DLLManager::DLLManager(const char *fname)
if (close(fd) == -1)
err = strerror(errno);
if (fclose(x) == EOF)
- err = strerror(errno);*/
+ err = strerror(errno);
h = dlopen(fname, RTLD_NOW|RTLD_LOCAL);
if (!h)
@@ -112,7 +112,7 @@ DLLManager::DLLManager(const char *fname)
return;
}
- /*log(DEBUG,"Finished loading '%s': %0x",tmpfile_template, h);
+ log(DEBUG,"Finished loading '%s': %0x",tmpfile_template, h);
// We can delete the tempfile once it's loaded, leaving just the inode.
if (!err && !Config->debugging)
@@ -120,7 +120,7 @@ DLLManager::DLLManager(const char *fname)
log(DEBUG,"Deleteting %s",tmpfile_template);
if (unlink(tmpfile_template) == -1)
err = strerror(errno);
- }*/
+ }
#endif
}
@@ -165,19 +165,14 @@ bool DLLManager::GetSymbol(void** v, const char* sym_name)
{
log(DEBUG,"Found symbol %s", sym_name);
dlerror(); // clear value
- *v = dlsym(h, "init_module");
+ *v = dlsym(h, sym_name);
err = dlerror();
-
- log(DEBUG,"%s",err);
if (!*v || err)
return false;
-
- log(DEBUG,"%0x %0x",dlsym(h, "init_module"), *v);
}
if (err)
{
- log(DEBUG,"Not found symbol");
return false;
}
else
@@ -188,7 +183,7 @@ bool DLLManager::GetSymbol(void** v, const char* sym_name)
#endif
-DLLFactoryBase::DLLFactoryBase(const char* fname, const char* factory) : DLLManager(fname)
+DLLFactoryBase::DLLFactoryBase(const char* fname, const char* symbol) : DLLManager(fname)
{
// try get the factory function if there is no error yet
factory_func = 0;
@@ -196,9 +191,9 @@ DLLFactoryBase::DLLFactoryBase(const char* fname, const char* factory) : DLLMana
if (!LastError())
{
#ifdef STATIC_LINK
- if (!GetSymbol( factory_func, factory ? factory : "init_module" ))
+ if (!GetSymbol( factory_func, symbol ? symbol : "init_module"))
#else
- if (!GetSymbol( (void **)&factory_func, factory ? factory : "init_module" ))
+ if (!GetSymbol( (void **)&factory_func, symbol ? symbol : "init_module"))
#endif
{
throw ModuleException("Missing init_module() entrypoint!");
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 79435ea58..cd5f74a0a 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -589,7 +589,6 @@ bool InspIRCd::LoadModule(const char* filename)
try
{
ircd_module* a = new ircd_module(modfile);
- log(DEBUG,"ircd_module constructor success, MODCOUNT %d",MODCOUNT);
factory[MODCOUNT+1] = a;
if (factory[MODCOUNT+1]->LastError())
{
@@ -597,10 +596,8 @@ bool InspIRCd::LoadModule(const char* filename)
snprintf(MODERR,MAXBUF,"Loader/Linker error: %s",factory[MODCOUNT+1]->LastError());
return false;
}
- log(DEBUG,"No last error");
if ((int)factory[MODCOUNT+1]->factory != -1)
{
- log(DEBUG,"Factory ptr: %0x",&factory[MODCOUNT+1]->factory);
Module* m = factory[MODCOUNT+1]->factory->CreateModule(MyServer);
modules[MODCOUNT+1] = m;
/* save the module and the module's classfactory, if
diff --git a/src/modules/m_devoice.cpp b/src/modules/m_devoice.cpp
index 346132eaa..b4ba9f117 100644
--- a/src/modules/m_devoice.cpp
+++ b/src/modules/m_devoice.cpp
@@ -63,7 +63,6 @@ class ModuleDeVoice : public Module
public:
ModuleDeVoice(Server* Me) : Module::Module(Me)
{
- log(DEBUG,"ModuleDeVoice constructor");
Srv = Me;
mycommand = new cmd_devoice();
Srv->AddCommand(mycommand);
@@ -93,7 +92,6 @@ class ModuleDeVoiceFactory : public ModuleFactory
virtual Module * CreateModule(Server* Me)
{
- log(DEBUG,"ModuleDevoiceFactory::CreateModule()");
return new ModuleDeVoice(Me);
}