From: Christian Hofstaedtler Date: Sat, 24 Aug 2013 12:38:26 +0000 (+0200) Subject: Remove dead sendData function X-Git-Tag: rec-3.6.0-rc1~506^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13edd674987acea3ef61ca6c562c696b4ef790c5;p=thirdparty%2Fpdns.git Remove dead sendData function Fix for Coverity CID 1029915, which claimed dead code inside the function, but really, nobody calls it anymore. --- diff --git a/pdns/misc.cc b/pdns/misc.cc index a64a00d0ef..866711052b 100644 --- a/pdns/misc.cc +++ b/pdns/misc.cc @@ -236,47 +236,6 @@ bool dottedEndsOn(const string &domain, const string &suffix) return true; } -int sendData(const char *buffer, int replen, int outsock) -{ - uint16_t nlen=htons(replen); - Utility::iovec iov[2]; - iov[0].iov_base=(char*)&nlen; - iov[0].iov_len=2; - iov[1].iov_base=(char*)buffer; - iov[1].iov_len=replen; - int ret=Utility::writev(outsock,iov,2); - - if(ret <= 0) // "EOF is error" - we can't deal with EAGAIN errors at this stage yet - return -1; - - if(ret!=replen+2) { - // we can safely assume ret > 2, as 2 is < PIPE_BUF - - buffer += (ret - 2); - replen -= (ret - 2); - - while (replen) { - ret = write(outsock, buffer, replen); - if(ret < 0) { - if(errno==EAGAIN) { // wait, we might've exhausted the window - while(waitForRWData(outsock, false, 1, 0)==0) - ; - continue; - } - return ret; - } - if(!ret) - return -1; // "EOF == error" - replen -= ret; - buffer += ret; - } - if(!replen) - return 0; - return -1; - } - return 0; -} - static void parseService4(const string &descr, ServiceTuple &st) { vectorparts; diff --git a/pdns/misc.hh b/pdns/misc.hh index 3a665fc113..1742d695a7 100644 --- a/pdns/misc.hh +++ b/pdns/misc.hh @@ -202,8 +202,6 @@ private: struct timeval d_set; }; -int sendData(const char *buffer, int replen, int outsock); - inline void DTime::set() { Utility::gettimeofday(&d_set,0);