From 91a05da525dc58f021ff6e1c2473da9c4a724659 Mon Sep 17 00:00:00 2001 From: Joe Orton Date: Tue, 19 Sep 2006 16:11:07 +0000 Subject: * network_io/unix/sockets.c (apr_socket_accept): Fix remote_addr handling; just use the "struct sockaddr" + length from the apr_sockaddr_t on the stack, copy them into the ->remote_addr set up by alloc_socket(). git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@447894 13f79535-47bb-0310-9956-ffa450edef68 --- network_io/unix/sockets.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'network_io') diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index 6da5acd15..94b26687c 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -179,9 +179,8 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, int s; apr_sockaddr_t sa; - memset(&sa, 0, sizeof(apr_sockaddr_t)); - apr_sockaddr_vars_set(&sa, sock->local_addr->sa.sin.sin_family, 0); - sa.pool = connection_context; + sa.salen = sizeof(sa.sa); + s = accept(sock->socketdes, (struct sockaddr *)&sa.sa, &sa.salen); if (s < 0) { @@ -204,7 +203,10 @@ apr_status_t apr_socket_accept(apr_socket_t **new, apr_socket_t *sock, (*new)->remote_addr_unknown = 0; (*new)->socketdes = s; - *(*new)->remote_addr = sa; + + /* Copy in peer's address. */ + (*new)->remote_addr->sa = sa.sa; + (*new)->remote_addr->salen = sa.salen; *(*new)->local_addr = *sock->local_addr; -- cgit v1.2.1