1
0
mirror of https://github.com/anope/anope.git synced 2026-06-28 16:36:39 +02:00

Remove tmp modules from the runtime folder when we can. Currently we cant remove them if we segfaulted, pretty much every other instance is now dealt with.

git-svn-id: svn://svn.anope.org/anope/trunk@936 31f1291d-b8d6-0310-a050-a5561fc1590b


git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@670 5417fbe8-f217-4b02-8779-1006273d7864
This commit is contained in:
rob rob@31f1291d-b8d6-0310-a050-a5561fc1590b
2005-11-08 20:47:50 +00:00
parent 2cfdc08695
commit fbf820b4e6
4 changed files with 29 additions and 22 deletions
+1
View File
@@ -1,6 +1,7 @@
Anope Version S V N
--------------------
Provided by Anope Dev. <dev@anope.org> - 2005
11/08 F Remove tmp modules from runtime folder when we can. [ #00]
11/02 F !protect/!deprotect no longer work for a number of ircds. [#403]
11/02 F segfault when os modloading a non-existing module. [ #00]
11/01 F /os reload - BSFantasyChar was not sstrduped if not defined. [ #00]
+1 -1
View File
@@ -841,7 +841,7 @@ E void ntoa(struct in_addr addr, char *ipaddr, int len);
/**** modules.c ****/
E void modules_core_init(int number, char **list);
E void modules_unload_all(void); /* Read warnings near function source */
E void modules_unload_all(boolean fini); /* Read warnings near function source */
E void moduleCallBackRun(void);
E void moduleCleanStruct(ModuleData **moduleData);
+5 -1
View File
@@ -223,6 +223,7 @@ static void services_restart(void)
#if defined(LINUX20) || defined(LINUX22)
pthread_kill_other_threads_np();
#endif
modules_unload_all(true);
execve(SERVICES_BIN, my_av, my_envp);
if (!readonly) {
open_log();
@@ -275,7 +276,7 @@ static void services_shutdown(void)
}
send_event(EVENT_SHUTDOWN, 1, EVENT_STOP);
disconn(servsock);
modules_unload_all(); /* Only legitimate use of this function */
modules_unload_all(true); /* Only legitimate use of this function */
}
/*************************************************************************/
@@ -355,6 +356,7 @@ void sighandler(int signum)
inbuf[448] = 0;
}
wallops(NULL, "PANIC! buffer = %s\r\n", inbuf);
modules_unload_all(false);
} else if (waiting < 0) {
/* This is static on the off-chance we run low on stack */
static char buf[BUFSIZE];
@@ -412,6 +414,7 @@ void sighandler(int signum)
}
wallops(NULL, "PANIC! %s (%s)", buf, strsignal(signum));
alog("PANIC! %s (%s)", buf, strsignal(signum));
modules_unload_all(false);
}
}
@@ -433,6 +436,7 @@ void sighandler(int signum)
if (signum == SIGSEGV) {
do_backtrace(1);
modules_unload_all(false); /* probably cant do this, but might as well try, we have nothing left to loose */
}
/* Should we send the signum here as well? -GD */
send_event(EVENT_SIGNAL, 1, quitmsg);
+22 -20
View File
@@ -207,36 +207,38 @@ void modules_delayed_init(void)
* And if that isn't enough discouragement, you'll wake up with your
* both legs broken tomorrow ;) -GD
*/
void modules_unload_all(void)
void modules_unload_all(boolean fini)
{
#ifdef USE_MODULES
int idx;
ModuleHash *mh, *next;
void (*func) (void);
void (*func) (void);
for (idx = 0; idx < MAX_CMD_HASH; idx++) {
mh = MODULE_HASH[idx];
while (mh) {
next = mh->next;
if (prepForUnload(mh->m) != MOD_ERR_OK) {
mh = next;
if(fini) {
if (prepForUnload(mh->m) != MOD_ERR_OK) {
mh = next;
continue;
}
func = (void (*)(void))ano_modsym(mh->m->handle, "AnopeFini");
if (func) {
mod_current_module_name = mh->m->name;
func(); /* exec AnopeFini */
mod_current_module_name = NULL;
}
if ((ano_modclose(mh->m->handle)) != 0)
alog(ano_moderr());
else
delModule(mh->m);
} else {
delModule(mh->m);
}
func = (void (*)(void))ano_modsym(mh->m->handle, "AnopeFini");
if (func) {
mod_current_module_name = mh->m->name;
func(); /* exec AnopeFini */
mod_current_module_name = NULL;
}
if ((ano_modclose(mh->m->handle)) != 0)
alog(ano_moderr());
else
delModule(mh->m);
mh = next;
mh = next;
}
}
#endif