]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
FDWrapper: Always reset the internal descriptor to -1 14015/head
authorRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 2 Apr 2024 07:54:15 +0000 (09:54 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Tue, 2 Apr 2024 09:44:55 +0000 (11:44 +0200)
Even if it was a different negative value, which happens for example
with the bpf helper functions which return `-errno`.

(cherry picked from commit eefbe57feca72af4a088e8e872e864dc36e9284e)

pdns/misc.hh

index 46e93f7ec15ad7c45f381e8e6c4c97fbc531713f..76887ee69cf2590336fb1852b3e3ddad62580765 100644 (file)
@@ -824,9 +824,9 @@ struct FDWrapper
   void reset()
   {
     if (d_fd >= 0) {
-      ::close(d_fd);
-      d_fd = -1;
+      close(d_fd);
     }
+    d_fd = -1;
   }
 
 private: