[svn] commit: r1544 - /trunk/src/bin/auth/main.cc

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Mar 18 21:50:38 UTC 2010


Author: shane
Date: Thu Mar 18 21:50:37 2010
New Revision: 1544

Log:
At Jinmei's suggestion, also handle errors in recv() and send().


Modified:
    trunk/src/bin/auth/main.cc

Modified: trunk/src/bin/auth/main.cc
==============================================================================
--- trunk/src/bin/auth/main.cc (original)
+++ trunk/src/bin/auth/main.cc Thu Mar 18 21:50:37 2010
@@ -473,6 +473,8 @@
     }
 }
 
+// XXX: this function does not handle partial reads or partial writes,
+//      and is VERY UNSAFE - will probably be removed or rewritten
 void
 processMessageTCP(const int fd, Message& dns_message,
                   MessageRenderer& response_renderer)
@@ -495,6 +497,13 @@
         cerr << "[XX] process TCP" << endl;
     }
     cc = recv(ts, sizebuf, 2, 0);
+    if (cc < 0) {
+        if (verbose_mode) {
+            cerr << "[XX] TCP recv failure:" << endl;
+        }
+        close(ts);
+        return;
+    }
     if (verbose_mode) {
         cerr << "[XX] got: " << cc << endl;
     }
@@ -548,6 +557,10 @@
                     cerr << "[XX] sent TCP response: " << cc << " bytes"
                          << endl;
                 }
+            }
+        } else {
+            if (verbose_mode) {
+                cerr << "TCP send error" << endl;
             }
         }
     }




More information about the bind10-changes mailing list