diff options
author | erdgeist <> | 2010-08-17 01:06:22 +0000 |
---|---|---|
committer | erdgeist <> | 2010-08-17 01:06:22 +0000 |
commit | aae0227ee66ffbb3ddc507d0be89854c23bd88af (patch) | |
tree | fbea7838b9aaf330e9958b04c58c883ef6e3c85b /opentracker.c | |
parent | 894bd4625f4c2744e64e7f143da1d4336fa74deb (diff) |
Load state only after initialising all structs. Thanks to Michael S. Combs for pointing out the buf
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/opentracker.c b/opentracker.c index a5b8b0d..579e41e 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -535,6 +535,7 @@ int main( int argc, char **argv ) { | |||
535 | ot_ip6 serverip, tmpip; | 535 | ot_ip6 serverip, tmpip; |
536 | int bound = 0, scanon = 1; | 536 | int bound = 0, scanon = 1; |
537 | uint16_t tmpport; | 537 | uint16_t tmpport; |
538 | char * statefile = 0; | ||
538 | 539 | ||
539 | memset( serverip, 0, sizeof(ot_ip6) ); | 540 | memset( serverip, 0, sizeof(ot_ip6) ); |
540 | #ifndef WANT_V6 | 541 | #ifndef WANT_V6 |
@@ -573,7 +574,7 @@ int main( int argc, char **argv ) { | |||
573 | case 'd': set_config_option( &g_serverdir, optarg ); break; | 574 | case 'd': set_config_option( &g_serverdir, optarg ); break; |
574 | case 'u': set_config_option( &g_serveruser, optarg ); break; | 575 | case 'u': set_config_option( &g_serveruser, optarg ); break; |
575 | case 'r': set_config_option( &g_redirecturl, optarg ); break; | 576 | case 'r': set_config_option( &g_redirecturl, optarg ); break; |
576 | case 'l': load_state( optarg ); break; | 577 | case 'l': statefile = optarg; break; |
577 | case 'A': | 578 | case 'A': |
578 | if( !scan_ip6( optarg, tmpip )) { usage( argv[0] ); exit( 1 ); } | 579 | if( !scan_ip6( optarg, tmpip )) { usage( argv[0] ); exit( 1 ); } |
579 | accesslist_blessip( tmpip, 0xffff ); /* Allow everything for now */ | 580 | accesslist_blessip( tmpip, 0xffff ); /* Allow everything for now */ |
@@ -614,6 +615,10 @@ int main( int argc, char **argv ) { | |||
614 | defaul_signal_handlers( ); | 615 | defaul_signal_handlers( ); |
615 | /* Init all sub systems. This call may fail with an exit() */ | 616 | /* Init all sub systems. This call may fail with an exit() */ |
616 | trackerlogic_init( ); | 617 | trackerlogic_init( ); |
618 | |||
619 | if( statefile ) | ||
620 | load_state( statefile ); | ||
621 | |||
617 | install_signal_handlers( ); | 622 | install_signal_handlers( ); |
618 | 623 | ||
619 | /* Kick off our initial clock setting alarm */ | 624 | /* Kick off our initial clock setting alarm */ |