]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
FDWrapper: Always reset the internal descriptor to -1 14006/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 07:54:15 +0000 (09:54 +0200)
Even if it was a different negative value, which happens for example
with the bpf helper functions which return `-errno`.

pdns/misc.hh

index 61116f20ab8f62f3ead33b0b7f5c3e65907028a0..e9a0dad36a221b5a202e60dfad33ea893e996168 100644 (file)
@@ -826,8 +826,8 @@ struct FDWrapper
     int ret = 0;
     if (d_fd >= 0) {
       ret = close(d_fd);
-      d_fd = -1;
     }
+    d_fd = -1;
     return ret;
   }