]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
Move subtraction in rephist to try to avoid STACK warning
authorNick Mathewson <nickm@torproject.org>
Sun, 26 Nov 2017 22:34:49 +0000 (17:34 -0500)
committerNick Mathewson <nickm@torproject.org>
Mon, 11 Dec 2017 21:23:11 +0000 (16:23 -0500)
(I do not know why this one is happening)

src/or/rephist.c

index 51e800bc31197a28c0b2cca728b34c37205b1445..b63cdbfcd6966f29ca7e9f4810ecbf394f2df91e 100644 (file)
@@ -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