apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jerenkra...@apache.org
Subject cvs commit: apr/network_io/unix sockaddr.c
Date Thu, 14 Aug 2003 00:09:28 GMT
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 {
  
  
  

Mime
View raw message