From: Remi Gacogne Date: Mon, 30 Aug 2021 15:39:19 +0000 (+0200) Subject: dnsdist: Unify the conflicting FDWrapper from rec and dnsdist X-Git-Tag: dnsdist-1.7.0-alpha1~23^2~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0adbef1134637414ffca9464580fe3561af37882;p=thirdparty%2Fpdns.git dnsdist: Unify the conflicting FDWrapper from rec and dnsdist --- diff --git a/pdns/misc.hh b/pdns/misc.hh index 5eefe8054a..3c54329e0e 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -674,6 +674,11 @@ struct FDWrapper return d_fd; } + operator int() const + { + return d_fd; + } + private: int d_fd{-1}; }; diff --git a/pdns/rec_channel_rec.cc b/pdns/rec_channel_rec.cc index 360b1f54c8..90dd8d9280 100644 --- a/pdns/rec_channel_rec.cc +++ b/pdns/rec_channel_rec.cc @@ -273,28 +273,6 @@ string static doGetParameter(T begin, T end) return ret; } -struct FDWrapper : public boost::noncopyable -{ - FDWrapper(int descr) : fd(descr) {} - ~FDWrapper() - { - if (fd != -1) { - close(fd); - } - fd = -1; - } - FDWrapper(FDWrapper&& rhs) : fd(rhs.fd) - { - rhs.fd = -1; - } - operator int() const - { - return fd; - } -private: - int fd; -}; - /* Read an (open) fd from the control channel */ static FDWrapper getfd(int s)