From: Pieter Lexis Date: Fri, 11 Aug 2017 12:14:24 +0000 (+0200) Subject: Fix a signed/unsigned comparison warning on ARM X-Git-Tag: rec-4.1.0-rc1~40^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F5597%2Fhead;p=thirdparty%2Fpdns.git Fix a signed/unsigned comparison warning on ARM --- diff --git a/pdns/dnsdist-tcp.cc b/pdns/dnsdist-tcp.cc index 70696d3dec..9d6c023c21 100644 --- a/pdns/dnsdist-tcp.cc +++ b/pdns/dnsdist-tcp.cc @@ -190,7 +190,11 @@ static bool sendResponseToClient(int fd, const char* response, uint16_t response static bool maxConnectionDurationReached(unsigned int maxConnectionDuration, time_t start, unsigned int& remainingTime) { if (maxConnectionDuration) { - time_t elapsed = time(NULL) - start; + time_t curtime = time(nullptr); + unsigned int elapsed = 0; + if (curtime > start) { // To prevent issues when time goes backward + elapsed = curtime - start; + } if (elapsed >= maxConnectionDuration) { return true; }