]> granicus.if.org Git - postgresql/commitdiff
Make getaddrinfo's behavior with NULL node parameter agree with the
authorTom Lane <tgl@sss.pgh.pa.us>
Sun, 27 Apr 2003 23:56:53 +0000 (23:56 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Sun, 27 Apr 2003 23:56:53 +0000 (23:56 +0000)
Linux man page for it.  This error was preventing CVS tip from accepting
remote connections.

src/port/getaddrinfo.c

index 972f6b6b39e599f7479154fb56ef3699ba78e6c8..438f578f16dfd18968ed138f13a90fc92d8e9f74 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *       $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.2 2003/04/02 00:49:28 tgl Exp $
+ *       $Header: /cvsroot/pgsql/src/port/getaddrinfo.c,v 1.3 2003/04/27 23:56:53 tgl Exp $
  *
  *-------------------------------------------------------------------------
  */
@@ -77,12 +77,14 @@ getaddrinfo(const char *node, const char *service,
                        if (hp->h_addrtype != AF_INET)
                                return EAI_ADDRFAMILY;
 
-                       memmove(&(sin.sin_addr), hp->h_addr, hp->h_length);
+                       memcpy(&(sin.sin_addr), hp->h_addr, hp->h_length);
                }
        }
        else
        {
                if (hints->ai_flags & AI_PASSIVE)
+                       sin.sin_addr.s_addr = htonl(INADDR_ANY);
+               else
                        sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
        }