From 0b75a272f361c2fcbefd1f286788cccfb631c5dd Mon Sep 17 00:00:00 2001 From: Pieter Lexis Date: Fri, 11 Aug 2017 14:14:24 +0200 Subject: [PATCH] Fix a signed/unsigned comparison warning on ARM --- pdns/dnsdist-tcp.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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; } -- 2.47.2