]> git.ipfire.org Git - thirdparty/pdns.git/blobdiff - pdns/iputils.cc
Wishy-washy
[thirdparty/pdns.git] / pdns / iputils.cc
index 0f9edcd1c33cbce79c857858dee773ee7440e4f2..a13645cbd182c9e07d8da88d56506c66a063a050 100644 (file)
@@ -41,7 +41,7 @@ int SSocket(int family, int type, int flags)
 {
   int ret = socket(family, type, flags);
   if(ret < 0)
-    RuntimeError(boost::format("creating socket of type %d: %s") % family % strerror(errno));
+    RuntimeError(boost::format("creating socket of type %d: %s") % family % stringerror());
   return ret;
 }
 
@@ -116,7 +116,7 @@ int SAccept(int sockfd, ComboAddress& remote)
 
   int ret = accept(sockfd, (struct sockaddr*)&remote, &remlen);
   if(ret < 0)
-    RuntimeError(boost::format("accepting new connection on socket: %s") % strerror(errno));
+    RuntimeError(boost::format("accepting new connection on socket: %s") % stringerror());
   return ret;
 }
 
@@ -124,7 +124,7 @@ int SListen(int sockfd, int limit)
 {
   int ret = listen(sockfd, limit);
   if(ret < 0)
-    RuntimeError(boost::format("setting socket to listen: %s") % strerror(errno));
+    RuntimeError(boost::format("setting socket to listen: %s") % stringerror());
   return ret;
 }
 
@@ -132,7 +132,7 @@ int SSetsockopt(int sockfd, int level, int opname, int value)
 {
   int ret = setsockopt(sockfd, level, opname, &value, sizeof(value));
   if(ret < 0)
-    RuntimeError(boost::format("setsockopt for level %d and opname %d to %d failed: %s") % level % opname % value % strerror(errno));
+    RuntimeError(boost::format("setsockopt for level %d and opname %d to %d failed: %s") % level % opname % value % stringerror());
   return ret;
 }
 
@@ -352,10 +352,11 @@ size_t sendMsgWithOptions(int fd, const char* buffer, size_t len, const ComboAdd
       return res;
     }
     else if (res == -1) {
-      if (errno == EINTR) {
+      int err = errno;
+      if (err == EINTR) {
         continue;
       }
-      else if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINPROGRESS || errno == ENOTCONN) {
+      else if (err == EAGAIN || err == EWOULDBLOCK || err == EINPROGRESS || err == ENOTCONN) {
         /* EINPROGRESS might happen with non blocking socket,
            especially with TCP Fast Open */
         return sent;