Load state only after initialising all structs. Thanks to Michael S. Combs for pointing out the buf

master
Dirk Engling 13 years ago
parent 9082b56ee6
commit a5606ae535

@ -2,7 +2,7 @@
It is considered beerware. Prost. Skol. Cheers or whatever.
Some of the stuff below is stolen from Fefes example libowfat httpd.
$Id: opentracker.c,v 1.230 2010/08/09 14:20:02 erdgeist Exp $ */
$Id: opentracker.c,v 1.231 2010/08/17 01:06:22 erdgeist Exp $ */
/* System */
#include <stdlib.h>
@ -535,6 +535,7 @@ int main( int argc, char **argv ) {
ot_ip6 serverip, tmpip;
int bound = 0, scanon = 1;
uint16_t tmpport;
char * statefile = 0;
memset( serverip, 0, sizeof(ot_ip6) );
#ifndef WANT_V6
@ -573,7 +574,7 @@ int main( int argc, char **argv ) {
case 'd': set_config_option( &g_serverdir, optarg ); break;
case 'u': set_config_option( &g_serveruser, optarg ); break;
case 'r': set_config_option( &g_redirecturl, optarg ); break;
case 'l': load_state( optarg ); break;
case 'l': statefile = optarg; break;
case 'A':
if( !scan_ip6( optarg, tmpip )) { usage( argv[0] ); exit( 1 ); }
accesslist_blessip( tmpip, 0xffff ); /* Allow everything for now */
@ -614,6 +615,10 @@ int main( int argc, char **argv ) {
defaul_signal_handlers( );
/* Init all sub systems. This call may fail with an exit() */
trackerlogic_init( );
if( statefile )
load_state( statefile );
install_signal_handlers( );
/* Kick off our initial clock setting alarm */
@ -624,4 +629,4 @@ int main( int argc, char **argv ) {
return 0;
}
const char *g_version_opentracker_c = "$Source: /home/cvsroot/opentracker/opentracker.c,v $: $Revision: 1.230 $\n";
const char *g_version_opentracker_c = "$Source: /home/cvsroot/opentracker/opentracker.c,v $: $Revision: 1.231 $\n";

Loading…
Cancel
Save