From: Remi Gacogne Date: Mon, 20 Sep 2021 07:40:00 +0000 (+0200) Subject: FDWrapper: Propery handle a negative descriptor in the move assignement operator X-Git-Tag: dnsdist-1.7.0-alpha1~7^2~3 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=54b2435ecfaf0d70328f62171c59de8ada48738a;p=thirdparty%2Fpdns.git FDWrapper: Propery handle a negative descriptor in the move assignement operator Reported by Coverity in CID 1462392. --- diff --git a/pdns/misc.hh b/pdns/misc.hh index 6307293f55..c31df9ca4f 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -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;