From 973c18bf0e84d14d8006a9ae97fde7f7fb97e404 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 11 Sep 2012 10:41:59 -0400 Subject: Fix assertion failure in tor_timegm. Fixes bug 6811. --- src/or/dirvote.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/or/dirvote.c') diff --git a/src/or/dirvote.c b/src/or/dirvote.c index ab08fd0200..a557fc782e 100644 --- a/src/or/dirvote.c +++ b/src/or/dirvote.c @@ -2536,7 +2536,7 @@ time_t dirvote_get_start_of_next_interval(time_t now, int interval) { struct tm tm; - time_t midnight_today; + time_t midnight_today=0; time_t midnight_tomorrow; time_t next; @@ -2545,7 +2545,9 @@ dirvote_get_start_of_next_interval(time_t now, int interval) tm.tm_min = 0; tm.tm_sec = 0; - midnight_today = tor_timegm(&tm); + if (tor_timegm(&tm, &midnight_today) < 0) { + log_warn(LD_BUG, "Ran into an invalid time when trying to find midnight."); + } midnight_tomorrow = midnight_today + (24*60*60); next = midnight_today + ((now-midnight_today)/interval + 1)*interval; -- cgit v1.2.3-54-g00ecf