]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Fix a signed/unsigned comparison warning on ARM 5597/head
authorPieter Lexis <pieter.lexis@powerdns.com>
Fri, 11 Aug 2017 12:14:24 +0000 (14:14 +0200)
committerPieter Lexis <pieter.lexis@powerdns.com>
Mon, 14 Aug 2017 11:54:26 +0000 (13:54 +0200)
pdns/dnsdist-tcp.cc

index 70696d3dec3be57a5a95c6ec5ed42c1ac0b1d92a..9d6c023c217518ffe3b00b15e137d0c7cc705bed 100644 (file)
@@ -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;
     }