]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
work around HP-UX UDP connect behavior [RT #18202]
authorTatuya JINMEI 神明達哉 <jinmei@isc.org>
Wed, 25 Jun 2008 22:57:01 +0000 (22:57 +0000)
committerTatuya JINMEI 神明達哉 <jinmei@isc.org>
Wed, 25 Jun 2008 22:57:01 +0000 (22:57 +0000)
lib/isc/unix/socket.c

index c5a23c6fdfb3ef2a40d1c44bcea3785a1fa0bafd..e75ffb7c861a54ce8ad1415502c0e5e1045a31fd 100644 (file)
@@ -15,7 +15,7 @@
  * PERFORMANCE OF THIS SOFTWARE.
  */
 
-/* $Id: socket.c,v 1.275.10.8 2008/06/25 00:10:40 jinmei Exp $ */
+/* $Id: socket.c,v 1.275.10.9 2008/06/25 22:57:01 jinmei Exp $ */
 
 /*! \file */
 
@@ -4390,6 +4390,16 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
        sock->peer_address = *addr;
        cc = connect(sock->fd, &addr->type.sa, addr->length);
        if (cc < 0) {
+               /*
+                * HP-UX "fails" to connect a UDP socket and sets errno to
+                * EINPROGRESS if it's non-blocking.  We'd rather regard this as
+                * a success and let the user detect it if it's really an error
+                * at the time of sending a packet on the socket.
+                */
+               if (sock->type == isc_sockettype_udp && errno == EINPROGRESS) {
+                       cc = 0;
+                       goto success;
+               }
                if (SOFT_ERROR(errno) || errno == EINPROGRESS)
                        goto queue;
 
@@ -4431,6 +4441,7 @@ isc_socket_connect(isc_socket_t *sock, isc_sockaddr_t *addr,
        /*
         * If connect completed, fire off the done event.
         */
+ success:
        if (cc == 0) {
                sock->connected = 1;
                sock->bound = 1;