aboutsummaryrefslogtreecommitdiff
path: root/src/or/dirvote.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-09-11 10:41:59 -0400
committerNick Mathewson <nickm@torproject.org>2012-09-11 13:13:07 -0400
commit973c18bf0e84d14d8006a9ae97fde7f7fb97e404 (patch)
tree4f8172e13883e45ecff9295737cc82e20dac3602 /src/or/dirvote.c
parent1c30e6abc93fa086a14d01d838066581a3657285 (diff)
downloadtor-973c18bf0e84d14d8006a9ae97fde7f7fb97e404.tar
tor-973c18bf0e84d14d8006a9ae97fde7f7fb97e404.tar.gz
Fix assertion failure in tor_timegm.
Fixes bug 6811.
Diffstat (limited to 'src/or/dirvote.c')
-rw-r--r--src/or/dirvote.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/or/dirvote.c b/src/or/dirvote.c
index ab08fd020..a557fc782 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;