summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-26 17:34:49 -0500
committerNick Mathewson <nickm@torproject.org>2017-12-11 16:23:11 -0500
commitf539d89fd9d19e44596976a42c12d4fd41f1d0fc (patch)
treeffccfb658048c48baff33ad66bfda30b2c1673d3
parent3da15bcbe8992b0dc3350902248ee791d1054642 (diff)
downloadtor-f539d89fd9d19e44596976a42c12d4fd41f1d0fc.tar.gz
tor-f539d89fd9d19e44596976a42c12d4fd41f1d0fc.zip
Move subtraction in rephist to try to avoid STACK warning
(I do not know why this one is happening)
-rw-r--r--src/or/rephist.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/or/rephist.c b/src/or/rephist.c
index 51e800bc31..b63cdbfcd6 100644
--- a/src/or/rephist.c
+++ b/src/or/rephist.c
@@ -1811,7 +1811,7 @@ static time_t last_prediction_add_time=0;
int
predicted_ports_prediction_time_remaining(time_t now)
{
- time_t idle_delta = now - last_prediction_add_time;
+ time_t idle_delta;
/* Protect against overflow of return value. This can happen if the clock
* jumps backwards in time. Update the last prediction time (aka last
@@ -1821,6 +1821,8 @@ predicted_ports_prediction_time_remaining(time_t now)
if (last_prediction_add_time > now) {
last_prediction_add_time = now;
idle_delta = 0;
+ } else {
+ idle_delta = now - last_prediction_add_time;
}
/* Protect against underflow of the return value. This can happen for very