// 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);
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)
{
log(DEBUG,"dlerror occured!");
- err = dlerror();
+ err = (char*)dlerror();
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)
log(DEBUG,"Deleteting %s",tmpfile_template);
if (unlink(tmpfile_template) == -1)
err = strerror(errno);
- }*/
+ }
#endif
}
{
log(DEBUG,"Found symbol %s", sym_name);
dlerror(); // clear value
- *v = dlsym(h, "init_module");
- err = dlerror();
-
- log(DEBUG,"%s",err);
+ *v = dlsym(h, sym_name);
+ err = (char*)dlerror();
if (!*v || err)
return false;
-
- log(DEBUG,"%0x %0x",dlsym(h, "init_module"), *v);
}
if (err)
{
- log(DEBUG,"Not found symbol");
return false;
}
else
#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;
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!");