not tested, not even compiled

Index: network_io/os2/sockets.c
===================================================================
RCS file: /home/cvspublic/apr/network_io/os2/sockets.c,v
retrieving revision 1.51
diff -u -r1.51 sockets.c
--- network_io/os2/sockets.c    13 Mar 2002 20:39:24 -0000      1.51
+++ network_io/os2/sockets.c    28 Mar 2002 18:29:59 -0000
@@ -87,35 +87,8 @@
 static void set_socket_vars(apr_socket_t *sock, int family, int type)
 {
     sock->type = type;
-    sock->local_addr->family = family;
-    sock->local_addr->sa.sin.sin_family = family;
-    sock->remote_addr->family = family;
-    sock->remote_addr->sa.sin.sin_family = family;
-
-    if (family == AF_INET) {
-        sock->local_addr->salen = sizeof(struct sockaddr_in);
-        sock->local_addr->addr_str_len = 16;
-        sock->local_addr->ipaddr_ptr = &(sock->local_addr->sa.sin.sin_addr);
-        sock->local_addr->ipaddr_len = sizeof(struct in_addr);
-
-        sock->remote_addr->salen = sizeof(struct sockaddr_in);
-        sock->remote_addr->addr_str_len = 16;
-        sock->remote_addr->ipaddr_ptr = &(sock->remote_addr->sa.sin.sin_addr);
-        sock->remote_addr->ipaddr_len = sizeof(struct in_addr);
-    }
-#if APR_HAVE_IPV6
-    else if (family == AF_INET6) {
-        sock->local_addr->salen = sizeof(struct sockaddr_in6);
-        sock->local_addr->addr_str_len = 46;
-        sock->local_addr->ipaddr_ptr = &(sock->local_addr->sa.sin6.sin6_addr);
-        sock->local_addr->ipaddr_len = sizeof(struct in6_addr);
-
-        sock->remote_addr->salen = sizeof(struct sockaddr_in6);
-        sock->remote_addr->addr_str_len = 46;
-        sock->remote_addr->ipaddr_ptr = 
&(sock->remote_addr->sa.sin6.sin6_addr);
-        sock->remote_addr->ipaddr_len = sizeof(struct in6_addr);
-    }
-#endif
+    apr_set_sockaddr_vars(sock->local_addr, family, 0);
+    apr_set_sockaddr_vars(sock->remote_addr, family, 0);
 }
 
 static void alloc_socket(apr_socket_t **new, apr_pool_t *p)
@@ -223,6 +196,8 @@
     if ((*new)->socketdes < 0) {
         return APR_OS2_STATUS(sock_errno());
     }
+    /* XXX fix up any pointers which are no longer valid (or just call
+     *     apr_set_socket_vars() to do it */
     (*new)->remote_addr->port = ntohs((*new)->remote_addr->sa.sin.sin_port);
     apr_pool_cleanup_register((*new)->cntxt, (void *)(*new), 
                         socket_cleanup, apr_pool_cleanup_null);

-- 
Jeff Trawick | [EMAIL PROTECTED]
Born in Roswell... married an alien...

Reply via email to