]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
2846. [bug] EOF on unix domain sockets was not being handled
authorMark Andrews <marka@isc.org>
Sun, 31 Jan 2010 23:18:03 +0000 (23:18 +0000)
committerMark Andrews <marka@isc.org>
Sun, 31 Jan 2010 23:18:03 +0000 (23:18 +0000)
                        correctly. [RT #20731]

CHANGES
lib/isc/unix/socket.c

diff --git a/CHANGES b/CHANGES
index 082cff5d50c7176eb2bcffc48219d294b5c458e8..c0e22ef8aad89afda08d592bffe656f1585cc788 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,3 +1,6 @@
+2846.  [bug]           EOF on unix domain sockets was not being handled
+                       correctly. [RT #20731]
+
 2845.  [bug]           RFC 5011 client could crash on shutdown. [RT #20903]
 
 2844.  [doc]           notify-delay default in ARM was wrong.  It should have
index c3e5430ff15fb14657e396f0007da7e9457ef275..5dbd872a9c3d7e44af011ea93a6691ff4d35433b 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: socket.c,v 1.326 2009/11/13 00:41:58 each Exp $ */
+/* $Id: socket.c,v 1.327 2010/01/31 23:18:03 marka Exp $ */
 
 /*! \file */
 
@@ -1674,12 +1674,22 @@ doio_recv(isc__socket_t *sock, isc_socketevent_t *dev) {
        }
 
        /*
-        * On TCP, zero length reads indicate EOF, while on
-        * UDP, zero length reads are perfectly valid, although
-        * strange.
+        * On TCP and UNIX sockets, zero length reads indicate EOF,
+        * while on UDP sockets, zero length reads are perfectly valid,
+        * although strange.
         */
-       if ((sock->type == isc_sockettype_tcp) && (cc == 0))
-               return (DOIO_EOF);
+       switch (sock->type) {
+       case isc_sockettype_tcp:
+       case isc_sockettype_unix:
+               if (cc == 0)
+                       return (DOIO_EOF);
+               break;
+       case isc_sockettype_udp:
+               break;
+       case isc_sockettype_fdwatch:
+       default:
+               INSIST(0);
+       }
 
        if (sock->type == isc_sockettype_udp) {
                dev->address.length = msghdr.msg_namelen;