X-Git-Url: https://jfr.im/git/irc/rqf/shadowircd.git/blobdiff_plain/f06c147c70cf72b40e4ec0ec3b5aca86662beb80..cb097b8840594b6a77aab21d0b4c20f036a7d012:/src/modules.c diff --git a/src/modules.c b/src/modules.c index a8b84af..ba56c96 100644 --- a/src/modules.c +++ b/src/modules.c @@ -109,8 +109,6 @@ struct Message modrestart_msgtab = { {mg_unreg, mg_not_oper, mg_ignore, mg_ignore, mg_ignore, {mo_modrestart, 0}} }; -extern struct Message error_msgtab; - void modules_init(void) { @@ -189,27 +187,6 @@ mod_clear_paths(void) mod_paths.length = 0; } -/* irc_basename - * - * input - - * output - - * side effects - - */ -char * -irc_basename(const char *path) -{ - char *mod_basename = rb_malloc(strlen(path) + 1); - const char *s; - - if(!(s = strrchr(path, '/'))) - s = path; - else - s++; - - (void) strcpy(mod_basename, s); - return mod_basename; -} - /* findmodule_byname * * input - @@ -357,7 +334,7 @@ mo_modload(struct Client *client_p, struct Client *source_p, int parc, const cha return 0; } - m_bn = irc_basename(parv[1]); + m_bn = rb_basename(parv[1]); if(findmodule_byname(m_bn) != -1) { @@ -388,7 +365,7 @@ mo_modunload(struct Client *client_p, struct Client *source_p, int parc, const c return 0; } - m_bn = irc_basename(parv[1]); + m_bn = rb_basename(parv[1]); if((modindex = findmodule_byname(m_bn)) == -1) { @@ -428,7 +405,7 @@ mo_modreload(struct Client *client_p, struct Client *source_p, int parc, const c return 0; } - m_bn = irc_basename(parv[1]); + m_bn = rb_basename(parv[1]); if((modindex = findmodule_byname(m_bn)) == -1) { @@ -446,11 +423,11 @@ mo_modreload(struct Client *client_p, struct Client *source_p, int parc, const c return 0; } - if((load_one_module(parv[1], check_core) == -1) && check_core) + if((load_one_module(m_bn, check_core) == -1) && check_core) { sendto_realops_snomask(SNO_GENERAL, L_ALL, - "Error reloading core module: %s: terminating ircd", parv[1]); - ilog(L_MAIN, "Error loading core module %s: terminating ircd", parv[1]); + "Error reloading core module: %s: terminating ircd", m_bn); + ilog(L_MAIN, "Error loading core module %s: terminating ircd", m_bn); exit(0); } @@ -533,6 +510,10 @@ mo_modrestart(struct Client *client_p, struct Client *source_p, int parc, const #define RTLD_NOW RTLD_LAZY /* openbsd deficiency */ #endif +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 0 +#endif + #ifdef CHARYBDIS_PROFILE # ifndef RTLD_PROFILE # warning libdl may not support profiling, sucks. :( @@ -789,12 +770,12 @@ load_a_module(const char *path, int warn, int core) int *mapi_version; - mod_basename = irc_basename(path); + mod_basename = rb_basename(path); #ifdef CHARYBDIS_PROFILE - tmpptr = dlopen(path, RTLD_NOW | RTLD_PROFILE); + tmpptr = dlopen(path, RTLD_NOW | RTLD_LOCAL | RTLD_PROFILE); #else - tmpptr = dlopen(path, RTLD_NOW); + tmpptr = dlopen(path, RTLD_NOW | RTLD_LOCAL); #endif if(tmpptr == NULL)