Return-Path: Delivered-To: apmail-apr-cvs-archive@apr.apache.org Received: (qmail 40709 invoked by uid 500); 14 Aug 2003 00:09:13 -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 40698 invoked from network); 14 Aug 2003 00:09:13 -0000 Date: 14 Aug 2003 00:09:28 -0000 Message-ID: <20030814000928.92552.qmail@minotaur.apache.org> From: jerenkrantz@apache.org To: apr-cvs@apache.org Subject: cvs commit: apr/network_io/unix sockaddr.c X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N jerenkrantz 2003/08/13 17:09:28 Modified: network_io/unix sockaddr.c Log: Make the getaddrinfo (IPv6) and gethostbyname (IPv4) implementations consistent in storing NULL values in the hostname if that is what was passed in by the caller. Revision Changes Path 1.40 +7 -2 apr/network_io/unix/sockaddr.c Index: sockaddr.c =================================================================== RCS file: /home/cvs/apr/network_io/unix/sockaddr.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -u -r1.39 -r1.40 --- sockaddr.c 13 Aug 2003 19:21:44 -0000 1.39 +++ sockaddr.c 14 Aug 2003 00:09:28 -0000 1.40 @@ -431,7 +431,9 @@ apr_sockaddr_vars_set(new_sa, ai->ai_family, port); if (!prev_sa) { /* first element in new list */ - new_sa->hostname = apr_pstrdup(p, hostname); + if (hostname) { + new_sa->hostname = apr_pstrdup(p, hostname); + } *sa = new_sa; } else { @@ -501,6 +503,7 @@ struct hostent hs; struct in_addr ipaddr; char *addr_list[2]; + const char *orig_hostname = hostname; if (hostname == NULL) { /* if we are given a NULL hostname, assume '0.0.0.0' */ @@ -560,7 +563,9 @@ apr_sockaddr_vars_set(new_sa, AF_INET, port); if (!prev_sa) { /* first element in new list */ - new_sa->hostname = apr_pstrdup(p, hostname); + if (orig_hostname) { + new_sa->hostname = apr_pstrdup(p, orig_hostname); + } *sa = new_sa; } else {