Make getaddrinfo's behavior with NULL node parameter agree with the

Linux man page for it.  This error was preventing CVS tip from accepting
remote connections.
This commit is contained in:
Tom Lane 2003-04-27 23:56:53 +00:00
parent 1045655a25
commit d08007ae77

View File

@ -8,7 +8,7 @@
* *
* *
* IDENTIFICATION * 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) if (hp->h_addrtype != AF_INET)
return EAI_ADDRFAMILY; return EAI_ADDRFAMILY;
memmove(&(sin.sin_addr), hp->h_addr, hp->h_length); memcpy(&(sin.sin_addr), hp->h_addr, hp->h_length);
} }
} }
else else
{ {
if (hints->ai_flags & AI_PASSIVE) if (hints->ai_flags & AI_PASSIVE)
sin.sin_addr.s_addr = htonl(INADDR_ANY);
else
sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK); sin.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
} }