]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
FDWrapper: Propery handle a negative descriptor in the move assignement operator
authorRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Sep 2021 07:40:00 +0000 (09:40 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Mon, 20 Sep 2021 09:43:01 +0000 (11:43 +0200)
Reported by Coverity in CID 1462392.

pdns/misc.hh

index 6307293f55cb91bd934da9192e6d003ee4d39c3b..c31df9ca4f00b45acf1137103440b7568859965c 100644 (file)
@@ -663,7 +663,7 @@ struct FDWrapper
 
   FDWrapper& operator=(FDWrapper&& rhs)
   {
-    if (d_fd) {
+    if (d_fd != -1) {
       close(d_fd);
     }
     d_fd = rhs.d_fd;