diff --git a/src/or/main.c b/src/or/main.c index 8076403940e1523bfdba821aefe555e3332a781f..bea5dbe1f4459502a6971b98be6a6fde17d13733 100644 --- a/src/or/main.c +++ b/src/or/main.c @@ -49,6 +49,7 @@ static int nfds=0; /**< Number of connections currently active. */ static int please_dumpstats=0; /**< Whether we should dump stats during the loop. */ static int please_reset=0; /**< Whether we just got a sighup. */ static int please_reap_children=0; /**< Whether we should waitpid for exited children. */ +static int please_sigpipe=0; /**< Whether we've caught a sigpipe lately. */ static int please_shutdown=0; /**< Whether we should shut down Tor. */ #endif /* signal stuff */ @@ -833,6 +834,10 @@ static int do_main_loop(void) { } please_shutdown = 0; } + if(please_sigpipe) { + log(LOG_NOTICE,"Caught sigpipe. Ignoring."); + please_sigpipe = 0; + } if(please_dumpstats) { /* prefer to log it at INFO, but make sure we always see it */ dumpstats(get_min_log_level()>LOG_INFO ? get_min_log_level() : LOG_INFO); @@ -898,7 +903,9 @@ static void catch(int the_signal) { please_shutdown = 1; break; case SIGPIPE: - log(LOG_NOTICE,"Caught sigpipe. Ignoring."); + /* don't log here, since it's possible you got the sigpipe because + * your log failed! */ + please_sigpipe = 1; break; case SIGHUP: please_reset = 1; @@ -911,6 +918,8 @@ static void catch(int the_signal) { break; default: log(LOG_WARN,"Caught signal %d that we can't handle??", the_signal); + tor_cleanup(); + exit(1); } #endif /* signal stuff */ } diff --git a/src/or/test.c b/src/or/test.c index 0ee815227fd1b3a604cccd32f76e6da682d422af..f09399144c94c470cd7059f3a02155b2f52b6d54 100644 --- a/src/or/test.c +++ b/src/or/test.c @@ -1023,7 +1023,6 @@ test_dir_format() test_eq(0, is_obsolete_version("0.0.5", "0.0.5-cvs")); test_eq(0, is_obsolete_version("0.0.5.1-cvs", "0.0.5")); - test_eq(0, tor_version_as_new_as("Tor 0.0.5", "0.0.9pre1-cvs")); test_eq(0, tor_version_as_new_as("Tor 0.0.5", "0.0.9pre1-cvs")); test_eq(1, tor_version_as_new_as( "Tor 0.0.8 on Darwin 64-121-192-100.c3-0.sfpo-ubr1.sfrn-sfpo.ca.cable.rcn.com Power Macintosh", "0.0.8rc2"));