aboutsummaryrefslogtreecommitdiff
path: root/src/feature
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-08-08 11:24:08 -0400
committerNick Mathewson <nickm@torproject.org>2019-08-08 11:24:08 -0400
commita8f936c817d0afc586c6791b9e02b94483c80ae3 (patch)
treed7776483d4e15e81b6ddea2872e69921add5d969 /src/feature
parent0acfd7dcee2a4473eba05a53d6df2d6d4fe2050b (diff)
parent0bc5b7ae95a2cc11b380ba09aab0ed1f4219f90b (diff)
downloadtor-a8f936c817d0afc586c6791b9e02b94483c80ae3.tar.gz
tor-a8f936c817d0afc586c6791b9e02b94483c80ae3.zip
Merge branch 'maint-0.4.1'
Diffstat (limited to 'src/feature')
-rw-r--r--src/feature/nodelist/routerlist.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/feature/nodelist/routerlist.c b/src/feature/nodelist/routerlist.c
index 709ceff53a..0cd7a76a9a 100644
--- a/src/feature/nodelist/routerlist.c
+++ b/src/feature/nodelist/routerlist.c
@@ -2861,7 +2861,7 @@ int
router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2)
{
time_t r1pub, r2pub;
- long time_difference;
+ time_t time_difference;
tor_assert(r1 && r2);
/* r1 should be the one that was published first. */
@@ -2925,7 +2925,9 @@ router_differences_are_cosmetic(const routerinfo_t *r1, const routerinfo_t *r2)
* give or take some slop? */
r1pub = r1->cache_info.published_on;
r2pub = r2->cache_info.published_on;
- time_difference = labs(r2->uptime - (r1->uptime + (r2pub - r1pub)));
+ time_difference = r2->uptime - (r1->uptime + (r2pub - r1pub));
+ if (time_difference < 0)
+ time_difference = - time_difference;
if (time_difference > ROUTER_ALLOW_UPTIME_DRIFT &&
time_difference > r1->uptime * .05 &&
time_difference > r2->uptime * .05)