apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@attglobal.net>
Subject Re: [patch] apr_sockaddr_port_get broken
Date Fri, 05 Apr 2002 21:42:33 GMT
Ryan Morgan <rmorgan@covalent.net> writes:

> The cleanup of the unix networking code a while back has broken 
> apr_sockaddr_port_get when 0 is specifed as the port to bind() to.  This
> is because we now grab the port from sockaddr->port rather than the
> actual sockaddr.  (sockaddr->port is never updated after 
> apr_sockaddr_port_set is called).

I would think that the better fix is to update sockaddr->port.

Can you try this instead (need win32 and os/2 flavors as well :( )?

(I can't play for a few hours.)

Index: srclib/apr/network_io/unix/sockaddr.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockaddr.c,v
retrieving revision 1.28
diff -u -r1.28 sockaddr.c
--- srclib/apr/network_io/unix/sockaddr.c       13 Mar 2002 20:39:25
-0000      1.28
+++ srclib/apr/network_io/unix/sockaddr.c       5 Apr 2002 21:44:21
-0000
@@ -64,6 +64,8 @@
     }
     else {
         sock->local_port_unknown = sock->local_interface_unknown = 0;
+        /* XXX assumes sin_port and sin6_port at same offset */
+        sock->local_addr->port = ntohs(sock->local_addr->sa.sin.sin_port);
         return APR_SUCCESS;
     }
 }

-- 
Jeff Trawick | trawick@attglobal.net
Born in Roswell... married an alien...

Mime
View raw message