summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-12-30 15:00:22 +0000
committergeniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b <geniusdex geniusdex@31f1291d-b8d6-0310-a050-a5561fc1590b@5417fbe8-f217-4b02-8779-1006273d7864>2004-12-30 15:00:22 +0000
commitae0f3c487d748a59cecde5a1fec8d67d3032a37f (patch)
treef1a2e19b21ff06baa5955b8bd5a9f9913188bb1a /src
parent2be671378524ee8feebb22ec218e8dd2e37418eb (diff)
BUILD : 1.7.6 (513) BUGS : NOTES : Added warnings for NULL-args with sstrdup, and NULL modname with module*Data functions. Fixed Catserv to use moduleAddCommand instead of addCommand.
git-svn-id: svn://svn.anope.org/anope/trunk@513 31f1291d-b8d6-0310-a050-a5561fc1590b git-svn-id: http://anope.svn.sourceforge.net/svnroot/anope/trunk@367 5417fbe8-f217-4b02-8779-1006273d7864
Diffstat (limited to 'src')
-rw-r--r--src/main.c10
-rw-r--r--src/memory.c4
-rw-r--r--src/modules.c24
-rw-r--r--src/modules/ircd_catserv.c4
4 files changed, 36 insertions, 6 deletions
diff --git a/src/main.c b/src/main.c
index e4bb9ccf6..a44cda93c 100644
--- a/src/main.c
+++ b/src/main.c
@@ -407,7 +407,7 @@ void sighandler(int signum)
}
if (signum == SIGSEGV) {
- do_backtrace();
+ do_backtrace(1);
}
if (started) {
@@ -578,7 +578,7 @@ int main(int ac, char **av, char **envp)
/*************************************************************************/
-void do_backtrace(void)
+void do_backtrace(int show_segheader)
{
#ifdef HAVE_BACKTRACE
void *array[50];
@@ -586,8 +586,10 @@ void do_backtrace(void)
char **strings;
int i;
- alog("Backtrace: Segmentation fault detected");
- alog("Backtrace: report the following lines");
+ if (show_segheader) {
+ alog("Backtrace: Segmentation fault detected");
+ alog("Backtrace: report the following lines");
+ }
alog("Backtrace: Anope version %s %s %s", version_number,
version_build, version_flags);
size = backtrace(array, 10);
diff --git a/src/memory.c b/src/memory.c
index 38e734aab..c1e1ba1c3 100644
--- a/src/memory.c
+++ b/src/memory.c
@@ -120,6 +120,10 @@ char *sstrdup(const char *src)
#else
abort();
#endif
+ } else {
+ alog("sstrdup() called with NULL-arg");
+ if (debug)
+ do_backtrace(0);
}
return ret;
diff --git a/src/modules.c b/src/modules.c
index 20dc37664..83913870f 100644
--- a/src/modules.c
+++ b/src/modules.c
@@ -1823,6 +1823,12 @@ int moduleAddData(ModuleData ** md, char *key, char *value)
alog("A module tried to use ModuleAddData() with one ore more NULL arguments... returning");
return MOD_ERR_PARAMS;
}
+
+ if (mod_current_module_name == NULL) {
+ alog("moduleAddData() called with mod_current_module_name being NULL");
+ if (debug)
+ do_backtrace(0);
+ }
moduleDelData(md, key); /* Remove any existing module data for this module with the same key */
@@ -1862,6 +1868,12 @@ char *moduleGetData(ModuleData ** md, char *key)
char *mod_name = sstrdup(mod_current_module_name);
ModuleData *current = *md;
+ if (mod_current_module_name == NULL) {
+ alog("moduleGetData() called with mod_current_module_name being NULL");
+ if (debug)
+ do_backtrace(0);
+ }
+
if (debug) {
alog("debug: moduleGetData %p : key %s", (void *) md, key);
alog("debug: Current Module %s", mod_name);
@@ -1891,6 +1903,12 @@ void moduleDelData(ModuleData ** md, char *key)
ModuleData *prev = NULL;
ModuleData *next = NULL;
+ if (mod_current_module_name == NULL) {
+ alog("moduleDelData() called with mod_current_module_name being NULL");
+ if (debug)
+ do_backtrace(0);
+ }
+
if (key) {
while (current) {
next = current->next;
@@ -1927,6 +1945,12 @@ void moduleDelAllData(ModuleData ** md)
ModuleData *prev = NULL;
ModuleData *next = NULL;
+ if (mod_current_module_name == NULL) {
+ alog("moduleDelAllData() called with mod_current_module_name being NULL");
+ if (debug)
+ do_backtrace(0);
+ }
+
while (current) {
next = current->next;
if ((stricmp(current->moduleName, mod_name) == 0)) {
diff --git a/src/modules/ircd_catserv.c b/src/modules/ircd_catserv.c
index 17aede270..89118e279 100644
--- a/src/modules/ircd_catserv.c
+++ b/src/modules/ircd_catserv.c
@@ -95,9 +95,9 @@ void addMessageList(void)
{
Command *c;
c = createCommand("meow", do_meow, NULL, -1, -1, -1, -1, -1);
- addCommand(Catserv_cmdTable, c, MOD_UNIQUE);
+ moduleAddCommand(Catserv_cmdTable, c, MOD_UNIQUE);
c = createCommand("purr", do_purr, NULL, -1, -1, -1, -1, -1);
- addCommand(Catserv_cmdTable, c, MOD_UNIQUE);
+ moduleAddCommand(Catserv_cmdTable, c, MOD_UNIQUE);
}
/*****************************************************************************/