Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 57030 invoked by uid 500); 14 Mar 2002 19:28:16 -0000 Mailing-List: contact cvs-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Reply-To: dev@apr.apache.org Delivered-To: mailing list cvs@apr.apache.org Received: (qmail 57019 invoked from network); 14 Mar 2002 19:28:16 -0000 Date: 14 Mar 2002 19:28:15 -0000 Message-ID: <20020314192815.76976.qmail@icarus.apache.org> From: trawick@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/network_io/unix sa_common.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N trawick 02/03/14 11:28:15 Modified: build apr_network.m4 network_io/unix sa_common.c Log: slight apr_sockaddr_info_get() simplification/speed-up: in the getaddrinfo() flavor we were needlessly building a string form of the port number to pass to getaddrinfo() so it would put it in the sockaddrs it built... but then we stuffed the port number in the sockaddrs anyway given that we no longer need getaddrinfo() to be able to handle port numbers properly, there is no sense checking for that ability at configure time suddenly we think that AIX 4.3.3.no-fixes has a working getaddrinfo() (it previously failed the pass-the-port-number- to-getaddrinfo check) but that level of AIX doesn't fill in the family field in the sockaddrs built by getaddrinfo()... rather than kludge around it in apr_sockaddr_info_get(), it is better to change the configure test to refuse to use getaddrinfo() on such a system Revision Changes Path 1.14 +4 -3 apr/build/apr_network.m4 Index: apr_network.m4 =================================================================== RCS file: /home/cvs/apr/build/apr_network.m4,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- apr_network.m4 11 Mar 2002 17:33:39 -0000 1.13 +++ apr_network.m4 14 Mar 2002 19:28:15 -0000 1.14 @@ -32,13 +32,14 @@ memset(&hints, 0, sizeof(hints)); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_STREAM; - error = getaddrinfo("127.0.0.1", "8080", &hints, &ai); + error = getaddrinfo("127.0.0.1", NULL, &hints, &ai); if (error) { exit(1); } - else { - exit(0); + if (ai->ai_addr->sa_family != AF_INET) { + exit(1); } + exit(0); } ],[ ac_cv_working_getaddrinfo="yes" 1.52 +1 -10 apr/network_io/unix/sa_common.c Index: sa_common.c =================================================================== RCS file: /home/cvs/apr/network_io/unix/sa_common.c,v retrieving revision 1.51 retrieving revision 1.52 diff -u -r1.51 -r1.52 --- sa_common.c 13 Mar 2002 20:39:25 -0000 1.51 +++ sa_common.c 14 Mar 2002 19:28:15 -0000 1.52 @@ -352,8 +352,6 @@ struct addrinfo hints, *ai, *ai_list; apr_sockaddr_t *cursa; int error; - char num[8]; - char *numptr; memset(&hints, 0, sizeof(hints)); hints.ai_flags = 0; /* XXX: might need a way to turn on AI_CANONNAME */ @@ -368,14 +366,7 @@ hints.ai_family = family; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = 0; - if (port) { - apr_snprintf(num, sizeof(num), "%d", port); - numptr = num; - } - else { - numptr = NULL; - } - error = getaddrinfo(hostname, numptr, &hints, &ai_list); + error = getaddrinfo(hostname, NULL, &hints, &ai_list); if (error) { if (error == EAI_SYSTEM) { return errno;