[NeoStats-Devel] [Commits] r2676 - in trunk: . src
[email protected] Tue, 19 Jul 2005 21:08:16 +1000
Newsgroups
gmane.comp.neostats.devel
Message-ID
<[email protected] >
Author: Fish
Date: Tue Jul 19 19:08:08 2005
New Revision: 2676
Modified:
trunk/ChangeLog
trunk/src/nsdba.c
trunk/src/perl.c
Log:
fix a shutdown crash caused during startup!
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Tue Jul 19 19:08:08 2005
@@ -4,6 +4,7 @@
Fish (F), Mark (M), DeadNotBuried (D)
===============================================================================
* NeoStats * Version 3.0.a3-dev
+ - Fix a crash on shutdown in nsdba relating to not statically storing the hash key (F)
- add missing modules lines to makeconf (D)
- increase module limit to 40 (D)
- TextServ: allow multiple channels per bot (D)
Modified: trunk/src/nsdba.c
==============================================================================
--- trunk/src/nsdba.c (original)
+++ trunk/src/nsdba.c Tue Jul 19 19:08:08 2005
@@ -142,16 +142,17 @@
hash_scan_begin( &ds, dbhash );
while(( node = hash_scan_next( &ds ) ) != NULL ) {
dbe = (dbentry *) hnode_get( node );
+ dlog(DEBUG1, "Closing Database %s", dbe->name);
hash_scan_begin( &ts, dbe->tablehash );
while(( tnode = hash_scan_next( &ts ) ) != NULL ) {
tbe = (tableentry *) hnode_get( tnode );
DBACloseTable( tbe->table );
- hash_delete( dbe->tablehash, tnode );
+ hash_scan_delete( dbe->tablehash, tnode );
hnode_destroy( tnode );
ns_free( tbe );
}
hash_destroy( dbe->tablehash );
- hash_delete( dbhash, node );
+ hash_scan_delete( dbhash, node );
hnode_destroy( node );
ns_free( dbe );
}
@@ -173,8 +174,9 @@
dlog( DEBUG1, "DBAOpenDatabase %s", GET_CUR_MODNAME() );
dbe = ns_calloc( sizeof( dbentry ) );
+ strlcpy(dbe->name, GET_CUR_MODNAME(), MAX_MOD_NAME);
dbe->tablehash = hash_create( -1, 0, 0 );
- hnode_create_insert( dbhash, dbe, GET_CUR_MODNAME() );
+ hnode_create_insert( dbhash, dbe, dbe->name);
return NS_SUCCESS;
}
Modified: trunk/src/perl.c
==============================================================================
--- trunk/src/perl.c (original)
+++ trunk/src/perl.c Tue Jul 19 19:08:08 2005
@@ -98,11 +98,11 @@
sv = GvSV (gv_fetchpv ("@", TRUE, SVt_PV));
if (SvTRUE (sv)) {
- nlog(LOG_WARNING, "Perl error: %s\n", SvPV(sv, count));
+ nlog(LOG_WARNING, "Perl error: %s", SvPV(sv, count));
POPs; /* remove undef from the top of the stack */
} else if (count != 1) {
nlog(LOG_WARNING, "Perl error: expected 1 value from %s, "
- "got: %d\n", (char *)function, count);
+ "got: %d", (char *)function, count);
} else {
ret_value = POPi;
}
@@ -1138,12 +1138,12 @@
mod->info->name = ns_malloc(strlen("NeoStats")+1);
ircsnprintf((char *)mod->info->name, strlen("NeoStats")+1, "NeoStats");
- PL_perl_destruct_level = 2;
+ PL_perl_destruct_level = 1;
mod->pm->my_perl = perl_alloc ();
- PL_perl_destruct_level = 2;
+ PL_perl_destruct_level = 1;
PERL_SET_CONTEXT((PMI *)mod->pm->my_perl);
perl_construct (mod->pm->my_perl);
- PL_perl_destruct_level = 2;
+ PL_perl_destruct_level = 1;
perl_parse (mod->pm->my_perl, xs_init, 4, perl_args, NULL);
/*
Now initialising the perl interpreter by loading the
@@ -1199,7 +1199,7 @@
PERL_SET_CONTEXT((PMI *)mod->pm->my_perl);
/* because segv handler doesn't handle perl well yet */
RESET_RUN_LEVEL()
- PL_perl_destruct_level = 2;
+ PL_perl_destruct_level = 1;
perl_destruct ((PMI *)mod->pm->my_perl);
perl_free ((PMI *)mod->pm->my_perl);