diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-07 20:42:18 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-08-07 20:42:18 +0000 |
commit | 233402b05c036aeb396af6ee27bf43f7405adb97 (patch) | |
tree | 61a4cddc05b8f814aa8bedd9436d0403d764ae31 /src/dynamic.cpp | |
parent | 7548a18e4c2fa474ec4bd370c483bd991fafaa00 (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/dynamic.cpp')
-rw-r--r-- | src/dynamic.cpp | 21 |
1 files changed, 8 insertions, 13 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!"); |