}
if (res != 0) {
- throw std::runtime_error("Error adding blocked qname " + qname.toLogString() + ": " + std::string(strerror(errno)));
+ throw std::runtime_error("Error adding blocked qname " + qname.toLogString() + ": " + stringerror()));
}
}
}
d_qNamesCount--;
}
else {
- throw std::runtime_error("Error removing qname address " + qname.toLogString() + ": " + std::string(strerror(errno)));
+ throw std::runtime_error("Error removing qname address " + qname.toLogString() + ": " + stringerror()));
}
}
}
if (setsockopt(fd, SOL_SOCKET, optname, (char*)&size, sizeof(size)) < 0 ) {
if (!g_quiet) {
- cerr<<"Warning: unable to raise socket buffer size to "<<size<<": "<<strerror(errno)<<endl;
+ cerr<<"Warning: unable to raise socket buffer size to "<<size<<": "<<stringerror()<<endl;
}
}
}
#if HAVE_SCHED_SETSCHEDULER
if(sched_setscheduler(0, SCHED_FIFO, ¶m) < 0) {
if (!g_quiet) {
- cerr<<"Unable to set SCHED_FIFO: "<<strerror(errno)<<endl;
+ cerr<<"Unable to set SCHED_FIFO: "<<stringerror()<<endl;
}
}
#endif
if (g_vm.count("plot-file")) {
plot.open(g_vm["plot-file"].as<string>());
if (!plot) {
- cerr<<"Error opening "<<g_vm["plot-file"].as<string>()<<" for writing: "<<strerror(errno)<<endl;
+ cerr<<"Error opening "<<g_vm["plot-file"].as<string>()<<" for writing: "<<stringerror()<<endl;
return EXIT_FAILURE;
}
}
pw.getHeader()->qr = 0;
if(::send(d_socket, &*packet.begin(), packet.size(), 0) < 0) {
- cout<<"Error sending: "<<strerror(errno)<<endl;
+ cout<<"Error sending: "<<stringerror()<<endl;
d_senderrors++;
}
{
ifstream ifs(fname);
if(!ifs)
- unixDie("Reading resolved names from "+fname+": "+string(strerror(errno)));
+ unixDie("Reading resolved names from "+fname+": "+stringerror()));
vector<string> parts;
string line;
addrs.clear();
gethostbyname("a.root-servers.net"); // this forces all lookup libraries to be loaded
Utility::dropGroupPrivs(newuid, newgid);
if(chroot(::arg()["chroot"].c_str())<0 || chdir("/")<0) {
- g_log<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<strerror(errno)<<", exiting"<<endl;
+ g_log<<Logger::Error<<"Unable to chroot to '"+::arg()["chroot"]+"': "<<stringerror()<<", exiting"<<endl;
exit(1);
}
else
#endif
#include "packetcache.hh"
#include "utility.hh"
-#include <errno.h>
#include "communicator.hh"
#include <set>
#include <boost/utility.hpp>
dvp.dp_fds = new pollfd[dvp.dp_nfds];
dvp.dp_timeout = timeout;
int ret=ioctl(d_devpollfd, DP_POLL, &dvp);
+ int err = errno;
gettimeofday(now,0); // MANDATORY!
- if(ret < 0 && errno!=EINTR) {
+ if(ret < 0 && err!=EINTR) {
delete[] dvp.dp_fds;
- throw FDMultiplexerException("/dev/poll returned error: "+stringerror());
+ throw FDMultiplexerException("/dev/poll returned error: "+stringerror(err));
}
if(ret < 1) { // thanks AB!
// some systems define getrandom but it does not really work, e.g. because it's
// not present in kernel.
if (getrandom(buf, sizeof(buf), 0) == -1) {
- g_log<<Logger::Warning<<"getrandom() failed: "<<strerror(errno)<<", falling back to " + rdev<<std::endl;
+ g_log<<Logger::Warning<<"getrandom() failed: "<<stringerror()<<", falling back to " + rdev<<std::endl;
chosen_rng = RNG_URANDOM;
}
}
}
if (!setNonBlocking(pipefds[0])) {
+ int err = errno;
close(pipefds[0]);
close(pipefds[1]);
- errlog("Error setting the TCP thread communication pipe non-blocking: %s", strerror(errno));
+ errlog("Error setting the TCP thread communication pipe non-blocking: %s", strerror(err));
return;
}
if (!setNonBlocking(pipefds[1])) {
+ int err = errno;
close(pipefds[0]);
close(pipefds[1]);
- errlog("Error setting the TCP thread communication pipe non-blocking: %s", strerror(errno));
+ errlog("Error setting the TCP thread communication pipe non-blocking: %s", strerror(err));
return;
}
}
return IOState::NeedRead;
}
else {
- throw std::runtime_error(std::string("Error while reading message: ") + strerror(errno));
+ throw std::runtime_error(std::string("Error while reading message: ") + stringerror());
}
}
if (errno == EAGAIN || errno == EINTR) {
return;
}
- throw std::runtime_error("Error while reading from the TCP acceptor pipe (" + std::to_string(pipefd) + ") in " + std::string(isNonBlocking(pipefd) ? "non-blocking" : "blocking") + " mode:" + strerror(errno));
+ throw std::runtime_error("Error while reading from the TCP acceptor pipe (" + std::to_string(pipefd) + ") in " + std::string(isNonBlocking(pipefd) ? "non-blocking" : "blocking") + " mode:" + stringerror());
}
else if (got != sizeof(citmp)) {
throw std::runtime_error("Partial read while reading from the TCP acceptor pipe (" + std::to_string(pipefd) + ") in " + std::string(isNonBlocking(pipefd) ? "non-blocking" : "blocking") + " mode");
++cs->tcpCurrentConnections;
if(ci->fd < 0) {
- throw std::runtime_error((boost::format("accepting new connection on socket: %s") % strerror(errno)).str());
+ throw std::runtime_error((boost::format("accepting new connection on socket: %s") % stringerror()).str());
}
if(!acl->match(remote)) {
}
if (res == -1) {
int err = errno;
- vinfolog("Error sending response to %s: %s", origRemote.toStringWithPort(), strerror(err));
+ vinfolog("Error sending response to %s: %s", origRemote.toStringWithPort(), stringerror(err));
}
}
int msgsGot = recvmmsg(cs->udpFD, msgVec.get(), vectSize, MSG_WAITFORONE | MSG_TRUNC, nullptr);
if (msgsGot <= 0) {
- vinfolog("Getting UDP messages via recvmmsg() failed with: %s", strerror(errno));
+ vinfolog("Getting UDP messages via recvmmsg() failed with: %s", stringerror());
continue;
}
int sent = sendmmsg(cs->udpFD, outMsgVec.get(), msgsToSend, 0);
if (sent < 0 || static_cast<unsigned int>(sent) != msgsToSend) {
- vinfolog("Error sending responses with sendmmsg() (%d on %u): %s", sent, msgsToSend, strerror(errno));
+ vinfolog("Error sending responses with sendmmsg() (%d on %u): %s", sent, msgsToSend, stringerror());
}
}
#ifdef IP_FREEBIND
if (setsockopt(sock, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0)
- warnlog("Warning: IP_FREEBIND setsockopt failed: %s", strerror(errno));
+ warnlog("Warning: IP_FREEBIND setsockopt failed: %s", stringerror());
#endif
#ifdef IP_BINDANY
if (af == AF_INET)
if (setsockopt(sock, IPPROTO_IP, IP_BINDANY, &one, sizeof(one)) < 0)
- warnlog("Warning: IP_BINDANY setsockopt failed: %s", strerror(errno));
+ warnlog("Warning: IP_BINDANY setsockopt failed: %s", stringerror());
#endif
#ifdef IPV6_BINDANY
if (af == AF_INET6)
if (setsockopt(sock, IPPROTO_IPV6, IPV6_BINDANY, &one, sizeof(one)) < 0)
- warnlog("Warning: IPV6_BINDANY setsockopt failed: %s", strerror(errno));
+ warnlog("Warning: IPV6_BINDANY setsockopt failed: %s", stringerror());
#endif
#ifdef SO_BINDANY
if (setsockopt(sock, SOL_SOCKET, SO_BINDANY, &one, sizeof(one)) < 0)
- warnlog("Warning: SO_BINDANY setsockopt failed: %s", strerror(errno));
+ warnlog("Warning: SO_BINDANY setsockopt failed: %s", stringerror());
#endif
}
if (gid) {
if (setgid(gid) == 0) {
if (setgroups(0, NULL) < 0) {
- warnlog("Warning: Unable to drop supplementary gids: %s", strerror(errno));
+ warnlog("Warning: Unable to drop supplementary gids: %s", stringerror());
}
}
else {
- warnlog("Warning: Unable to set group ID to %d: %s", gid, strerror(errno));
+ warnlog("Warning: Unable to set group ID to %d: %s", gid, stringerror());
}
}
}
{
if(uid) {
if(setuid(uid) < 0) {
- warnlog("Warning: Unable to set user ID to %d: %s", uid, strerror(errno));
+ warnlog("Warning: Unable to set user ID to %d: %s", uid, stringerror());
}
}
}
#ifdef SO_BINDTODEVICE
int res = setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE, itf.c_str(), itf.length());
if (res != 0) {
- warnlog("Error setting up the interface on local address '%s': %s", cs->local.toStringWithPort(), strerror(errno));
+ warnlog("Error setting up the interface on local address '%s': %s", cs->local.toStringWithPort(), stringerror());
}
#else
if (warn) {
#include <sys/types.h>
#include <iostream>
#include <string>
-#include <errno.h>
#include <boost/tokenizer.hpp>
#include <boost/functional/hash.hpp>
#include <boost/algorithm/string.hpp>
ofstream fp(argv[2]);
if (!fp) {
- cerr<<"Error opening output file "<<argv[2]<<": "<<strerror(errno)<<endl;
+ cerr<<"Error opening output file "<<argv[2]<<": "<<stringerror()<<endl;
exit(EXIT_FAILURE);
}
FILE* fp = fopen(argv[2], "w");
if (!fp) {
- cerr<<"Error opening output file "<<argv[2]<<": "<<strerror(errno)<<endl;
+ cerr<<"Error opening output file "<<argv[2]<<": "<<stringerror()<<endl;
exit(EXIT_FAILURE);
}
#include "dnsproxy.hh"
#include "pdnsexception.hh"
#include <sys/types.h>
-#include <errno.h>
#include "dns.hh"
#include "logger.hh"
#include "statbag.hh"
d_remote = ComboAddress(addresses[0], 53);
if((d_sock=socket(d_remote.sin4.sin_family, SOCK_DGRAM,0))<0) {
- throw PDNSException(string("socket: ")+strerror(errno));
+ throw PDNSException(string("socket: ")+stringerror());
}
ComboAddress local;
if(n==10) {
closesocket(d_sock);
d_sock=-1;
- throw PDNSException(string("binding dnsproxy socket: ")+strerror(errno));
+ throw PDNSException(string("binding dnsproxy socket: ")+stringerror());
}
if(connect(d_sock, (sockaddr *)&d_remote, d_remote.getSocklen())<0) {
if(i->second.anyLocal) {
addCMsgSrcAddr(&msgh, cbuf, i->second.anyLocal.get_ptr(), 0);
}
- if(sendmsg(i->second.outsock, &msgh, 0) < 0)
- g_log<<Logger::Warning<<"dnsproxy.cc: Error sending reply with sendmsg (socket="<<i->second.outsock<<"): "<<strerror(errno)<<endl;
-
+ if(sendmsg(i->second.outsock, &msgh, 0) < 0) {
+ int err = errno;
+ g_log<<Logger::Warning<<"dnsproxy.cc: Error sending reply with sendmsg (socket="<<i->second.outsock<<"): "<<stringerror(err)<<endl;
+ }
i->second.created=0;
}
}
}
if (setsockopt(fd, SOL_SOCKET, optname, (char*)&size, sizeof(size)) < 0 )
- cerr<<"Warning: unable to raise socket buffer size to "<<size<<": "<<strerror(errno)<<endl;
+ cerr<<"Warning: unable to raise socket buffer size to "<<size<<": "<<stringerror()<<endl;
}
static void setSocketReceiveBuffer(int fd, uint32_t size)
Socket sock(g_dest.sin4.sin_family, SOCK_STREAM);
int tmp=1;
if(setsockopt(sock.getHandle(),SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0)
- throw runtime_error("Unable to set socket reuse: "+string(strerror(errno)));
+ throw runtime_error("Unable to set socket reuse: "+stringerror());
if(g_tcpNoDelay && setsockopt(sock.getHandle(), IPPROTO_TCP, TCP_NODELAY,(char*)&tmp,sizeof tmp)<0)
- throw runtime_error("Unable to set socket no delay: "+string(strerror(errno)));
+ throw runtime_error("Unable to set socket no delay: "+stringerror());
sock.connect(g_dest);
uint16_t len = htons(packet.size());
#include <sys/socket.h>
#include <netinet/in.h>
-#include <errno.h>
#include <iostream>
#include <sstream>
#include <sys/types.h>
if(d_s < 0) {
if (family == AF_UNIX)
- g_log<<Logger::Error<<"Unable to create control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to create control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<stringerror()<<endl;
else
- g_log<<Logger::Error<<"Unable to create control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to create control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<stringerror()<<endl;
exit(1);
}
int tmp=1;
if(setsockopt(d_s,SOL_SOCKET,SO_REUSEADDR,(char*)&tmp,sizeof tmp)<0)
- throw PDNSException(string("Setsockopt failed on control socket: ")+strerror(errno));
+ throw PDNSException(string("Setsockopt failed on control socket: ")+stringerror());
if(bind(d_s, local, len) < 0) {
if (family == AF_UNIX)
- g_log<<Logger::Critical<<"Unable to bind to control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<strerror(errno)<<endl;
+ g_log<<Logger::Critical<<"Unable to bind to control socket at '"<<((struct sockaddr_un*)local)->sun_path<<"', reason: "<<stringerror()<<endl;
else
- g_log<<Logger::Critical<<"Unable to bind to control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<strerror(errno)<<endl;
+ g_log<<Logger::Critical<<"Unable to bind to control socket on '"<<((ComboAddress *)local)->toStringWithPort()<<"', reason: "<<stringerror()<<endl;
exit(1);
}
}
}
int err=unlink(fname.c_str());
if(err < 0 && errno!=ENOENT) {
- g_log<<Logger::Critical<<"Unable to remove (previous) controlsocket at '"<<fname<<"': "<<strerror(errno)<<endl;
+ g_log<<Logger::Critical<<"Unable to remove (previous) controlsocket at '"<<fname<<"': "<<stringerror()<<endl;
exit(1);
}
d_socketname=fname;
if(!arg()["setgid"].empty()) {
if(chmod(fname.c_str(),0660)<0)
- g_log<<Logger::Error<<"Unable to change group access mode of controlsocket at '"<<fname<<"', reason: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to change group access mode of controlsocket at '"<<fname<<"', reason: "<<stringerror()<<endl;
if(chown(fname.c_str(),static_cast<uid_t>(-1), strToGID(arg()["setgid"]))<0)
- g_log<<Logger::Error<<"Unable to change group ownership of controlsocket at '"<<fname<<"', reason: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to change group ownership of controlsocket at '"<<fname<<"', reason: "<<stringerror()<<endl;
}
listen(d_s, 10);
d_client=accept(d_s,(sockaddr*)&remote,&remlen);
if(d_client<0) {
if(errno!=EINTR)
- g_log<<Logger::Error<<"Unable to accept controlsocket connection ("<<d_s<<"): "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to accept controlsocket connection ("<<d_s<<"): "<<stringerror()<<endl;
continue;
}
std::shared_ptr<FILE> fp=std::shared_ptr<FILE>(fdopen(dup(d_client), "r"), fclose);
if(d_tcp) {
if(!fgets(&mesg[0], mesg.size(), fp.get())) {
- g_log<<Logger::Error<<"Unable to receive password from controlsocket ("<<d_client<<"): "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to receive password from controlsocket ("<<d_client<<"): "<<stringerror()<<endl;
close(d_client);
continue;
}
errno=0;
if(!fgets(&mesg[0], mesg.size(), fp.get())) {
if(errno)
- g_log<<Logger::Error<<"Unable to receive line from controlsocket ("<<d_client<<"): "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to receive line from controlsocket ("<<d_client<<"): "<<stringerror()<<endl;
close(d_client);
continue;
}
#include <cstring>
#include <cstdlib>
#include <unistd.h>
-#include <errno.h>
#include <climits>
#include <string>
#include <map>
#include "utility.hh"
#include <cstdlib>
#include <cstring>
-#include <cerrno>
#include <iostream>
#include <sys/types.h>
#include <sys/stat.h>
setCloseOnExec(d_s);
if(d_s<0) {
- throw PDNSException(string("socket")+strerror(errno));
+ throw PDNSException(string("socket")+stringerror());
}
try {
setCloseOnExec(d_s);
if(d_s<0) {
- throw PDNSException(string("socket")+strerror(errno));
+ throw PDNSException(string("socket")+stringerror());
}
try {
int ret = Utility::timed_connect(d_s, (sockaddr*)&remote, remote.getSocklen(), timeout_sec, timeout_usec);
if (ret == 0)
- throw TimeoutException("Unable to connect to remote '"+remote.toStringWithPort()+"': "+string(strerror(errno)));
+ throw TimeoutException("Unable to connect to remote '"+remote.toStringWithPort()+"': "+stringerror());
else if (ret < 0)
- throw PDNSException("Unable to connect to remote '"+remote.toStringWithPort()+"': "+string(strerror(errno)));
+ throw PDNSException("Unable to connect to remote '"+remote.toStringWithPort()+"': "+stringerror());
string login=secret+"\n";
writen2(d_s, login);
retlen=recv(d_s,buffer,sizeof(buffer),0);
if(retlen<0) {
if (errno == EAGAIN)
- throw TimeoutException("Error from remote in receive(): " + string(strerror(errno)));
+ throw TimeoutException("Error from remote in receive(): " + stringerror());
else
- throw PDNSException("Error from remote in receive(): " + string(strerror(errno)));
+ throw PDNSException("Error from remote in receive(): " + stringerror());
}
answer.append(buffer,retlen);
/* -1 means server unreachable */
s_unreachables++;
d_unreachables++;
- LOG(prefix<<qname<<": error resolving from "<<remoteIP.toString()<< (doTCP ? " over TCP" : "") <<", possible error: "<<strerror(errno)<< endl);
+ // XXX questionable use of errno
+ LOG(prefix<<qname<<": error resolving from "<<remoteIP.toString()<< (doTCP ? " over TCP" : "") <<", possible error: "<<stringerror()<< endl);
}
if(resolveret != -2 && !chained && !dontThrottle) {
#ifdef TCP_FASTOPEN
int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
if (setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
- g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<stringerror()<<endl;
}
#else
g_log<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
Utility::setBindAny(AF_INET, s);
if(::bind(s, (sockaddr*)&local, local.getSocklen())<0) {
+ int err = errno;
close(s);
- if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-address-nonexist-fail") ) {
+ if( err == EADDRNOTAVAIL && ! ::arg().mustDo("local-address-nonexist-fail") ) {
g_log<<Logger::Error<<"IPv4 Address " << *laddr << " does not exist on this server - skipping TCP bind" << endl;
continue;
} else {
- g_log<<Logger::Error<<"Unable to bind to TCP socket " << *laddr << ": "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to bind to TCP socket " << *laddr << ": "<<stringerror(err)<<endl;
throw PDNSException("Unable to bind to TCP socket");
}
}
#ifdef TCP_FASTOPEN
int fastOpenQueueSize = ::arg().asNum("tcp-fast-open");
if (setsockopt(s, IPPROTO_TCP, TCP_FASTOPEN, &fastOpenQueueSize, sizeof fastOpenQueueSize) < 0) {
- g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Failed to enable TCP Fast Open for listening socket: "<<stringerror()<<endl;
}
#else
g_log<<Logger::Warning<<"TCP Fast Open configured but not supported for listening socket"<<endl;
if( ::arg().mustDo("non-local-bind") )
Utility::setBindAny(AF_INET6, s);
if(setsockopt(s, IPPROTO_IPV6, IPV6_V6ONLY, &tmp, sizeof(tmp)) < 0) {
- g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Failed to set IPv6 socket to IPv6 only, continuing anyhow: "<<stringerror()<<endl;
}
if(bind(s, (const sockaddr*)&local, local.getSocklen())<0) {
+ int err = errno;
close(s);
- if( errno == EADDRNOTAVAIL && ! ::arg().mustDo("local-ipv6-nonexist-fail") ) {
+ if( err == EADDRNOTAVAIL && ! ::arg().mustDo("local-ipv6-nonexist-fail") ) {
g_log<<Logger::Error<<"IPv6 Address " << *laddr << " does not exist on this server - skipping TCP bind" << endl;
continue;
} else {
- g_log<<Logger::Error<<"Unable to bind to TCPv6 socket" << *laddr << ": "<<strerror(errno)<<endl;
+ g_log<<Logger::Error<<"Unable to bind to TCPv6 socket" << *laddr << ": "<<strerror(err)<<endl;
throw PDNSException("Unable to bind to TCPv6 socket");
}
}
addrlen=remote.getSocklen();
if((fd=accept(sock, (sockaddr*)&remote, &addrlen))<0) {
- g_log<<Logger::Error<<"TCP question accept error: "<<strerror(errno)<<endl;
+ int err = errno;
+ g_log<<Logger::Error<<"TCP question accept error: "<<stringerror(err)<<endl;
- if(errno==EMFILE) {
+ if(err==EMFILE) {
g_log<<Logger::Error<<"TCP handler out of filedescriptors, exiting, won't recover from this"<<endl;
_exit(1);
}
if(room<1)
g_log<<Logger::Warning<<"Limit of simultaneous TCP connections reached - raise max-tcp-connections"<<endl;
- if(pthread_create(&tid, 0, &doConnection, reinterpret_cast<void*>(fd))) {
- g_log<<Logger::Error<<"Error creating thread: "<<stringerror()<<endl;
+ int err;
+ if((err = pthread_create(&tid, 0, &doConnection, reinterpret_cast<void*>(fd)))) {
+ g_log<<Logger::Error<<"Error creating thread: "<<stringerror(err)<<endl;
d_connectionroom_sem->post();
close(fd);
decrementClientCount(remote);
int bread=d_rsock.read((char *) &len, 2);
if( bread <0)
- throw PDNSException("tcp read failed: "+std::string(strerror(errno)));
+ throw PDNSException("tcp read failed: "+stringerror());
if(bread != 2)
throw PDNSException("EOF on TCP read");
numread=d_rsock.read(creply+n, len-n);
if(numread<0) {
delete[] creply;
- throw PDNSException("tcp read failed: "+std::string(strerror(errno)));
+ throw PDNSException("tcp read failed: "+stringerror());
}
n+=numread;
}
(void) one; // avoids 'unused var' warning on systems that have none of the defines checked below
#ifdef IP_FREEBIND
if (setsockopt(sock, IPPROTO_IP, IP_FREEBIND, &one, sizeof(one)) < 0)
- g_log<<Logger::Warning<<"Warning: IP_FREEBIND setsockopt failed: "<<strerror(errno)<<endl;
+ g_log<<Logger::Warning<<"Warning: IP_FREEBIND setsockopt failed: "<<stringerror()<<endl;
#endif
#ifdef IP_BINDANY
if (af == AF_INET)
if (setsockopt(sock, IPPROTO_IP, IP_BINDANY, &one, sizeof(one)) < 0)
- g_log<<Logger::Warning<<"Warning: IP_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
+ g_log<<Logger::Warning<<"Warning: IP_BINDANY setsockopt failed: "<<stringerror()<<endl;
#endif
#ifdef IPV6_BINDANY
if (af == AF_INET6)
if (setsockopt(sock, IPPROTO_IPV6, IPV6_BINDANY, &one, sizeof(one)) < 0)
- g_log<<Logger::Warning<<"Warning: IPV6_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
+ g_log<<Logger::Warning<<"Warning: IPV6_BINDANY setsockopt failed: "<<stringerror()<<endl;
#endif
#ifdef SO_BINDANY
if (setsockopt(sock, SOL_SOCKET, SO_BINDANY, &one, sizeof(one)) < 0)
- g_log<<Logger::Warning<<"Warning: SO_BINDANY setsockopt failed: "<<strerror(errno)<<endl;
+ g_log<<Logger::Warning<<"Warning: SO_BINDANY setsockopt failed: "<<stringerror()<<endl;
#endif
}