diff options
author | erdgeist <> | 2007-08-11 13:39:36 +0000 |
---|---|---|
committer | erdgeist <> | 2007-08-11 13:39:36 +0000 |
commit | 77af0b475f16c635b91ce5f38278eea71768b849 (patch) | |
tree | 3322aae83a61d93794a6b80495894da768542478 /opentracker.c | |
parent | 51e4b179ab389b0665f4d80a1f56459fa9e37f00 (diff) |
Sort of addressed a concorrency issue when receiving mutliple SIG_HUPs
Diffstat (limited to 'opentracker.c')
-rw-r--r-- | opentracker.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/opentracker.c b/opentracker.c index ff1c1c6..d97e73e 100644 --- a/opentracker.c +++ b/opentracker.c | |||
@@ -759,15 +759,19 @@ static void ot_try_bind( char ip[4], uint16 port, int is_tcp ) { | |||
759 | #ifdef WANT_BLACKLISTING | 759 | #ifdef WANT_BLACKLISTING |
760 | /* Read initial black list */ | 760 | /* Read initial black list */ |
761 | void read_blacklist_file( int foo ) { | 761 | void read_blacklist_file( int foo ) { |
762 | FILE * blacklist_filehandle = fopen( blacklist_filename, "r" ); | 762 | FILE * blacklist_filehandle; |
763 | ot_hash infohash; | 763 | ot_hash infohash; |
764 | foo = foo; | 764 | foo = foo; |
765 | 765 | ||
766 | signal( SIGHUP, SIG_IGN ); | ||
767 | blacklist_filehandle = fopen( blacklist_filename, "r" ); | ||
768 | |||
766 | /* Free blacklist vector in trackerlogic.c*/ | 769 | /* Free blacklist vector in trackerlogic.c*/ |
767 | blacklist_reset(); | 770 | blacklist_reset(); |
768 | 771 | ||
769 | if( blacklist_filehandle == NULL ) { | 772 | if( blacklist_filehandle == NULL ) { |
770 | fprintf( stderr, "Warning: Can't open blacklist file: %s (but will try to create it later, if necessary and possible).", blacklist_filename ); | 773 | fprintf( stderr, "Warning: Can't open blacklist file: %s (but will try to create it later, if necessary and possible).", blacklist_filename ); |
774 | signal( SIGHUP, read_blacklist_file ); | ||
771 | return; | 775 | return; |
772 | } | 776 | } |
773 | 777 | ||
@@ -789,7 +793,9 @@ void read_blacklist_file( int foo ) { | |||
789 | ignore_line: | 793 | ignore_line: |
790 | continue; | 794 | continue; |
791 | } | 795 | } |
796 | |||
792 | fclose( blacklist_filehandle ); | 797 | fclose( blacklist_filehandle ); |
798 | signal( SIGHUP, read_blacklist_file ); | ||
793 | } | 799 | } |
794 | #endif | 800 | #endif |
795 | 801 | ||