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).
A simple patch is:
Index: sa_common.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/unix/sa_common.c,v
retrieving revision 1.53
diff -u -r1.53 sa_common.c
--- sa_common.c 28 Mar 2002 18:17:02 -0000 1.53
+++ sa_common.c 5 Apr 2002 21:20:58 -0000
@@ -139,7 +139,7 @@
APR_DECLARE(apr_status_t) apr_sockaddr_port_get(apr_port_t *port,
apr_sockaddr_t *sockaddr)
{
- *port = sockaddr->port;
+ *port = ntohs(sockaddr->sa.sin.sin_port);
return APR_SUCCESS;
}
But i assume this is wrong, since this just reverts the changes that
Jeff made a week or two ago.
-Ryan