Ensure getaddrinfo_all returns null result on failure.
authorTom Lane
Sat, 24 Apr 2004 20:10:34 +0000 (20:10 +0000)
committerTom Lane
Sat, 24 Apr 2004 20:10:34 +0000 (20:10 +0000)
src/backend/libpq/ip.c

index 790cf3254cc8c59d4ed754cf50f08c6be504c351..bc6a7b98d8f1defb27cf70d77904dc28c80e8769 100644 (file)
@@ -8,7 +8,7 @@
  *
  *
  * IDENTIFICATION
- *   $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.24 2003/11/29 19:51:49 pgsql Exp $
+ *   $PostgreSQL: pgsql/src/backend/libpq/ip.c,v 1.25 2004/04/24 20:10:34 tgl Exp $
  *
  * This file and the IPV6 implementation were initially provided by
  * Nigel Kukard , Linux Based Systems Design
@@ -67,8 +67,11 @@ static int getnameinfo_unix(const struct sockaddr_un * sa, int salen,
  */
 int
 getaddrinfo_all(const char *hostname, const char *servname,
-               const struct addrinfo * hintp, struct addrinfo ** result)
+               const struct addrinfo *hintp, struct addrinfo **result)
 {
+   /* not all versions of getaddrinfo() zero *result on failure */
+   *result = NULL;
+
 #ifdef HAVE_UNIX_SOCKETS
    if (hintp != NULL && hintp->ai_family == AF_UNIX)
        return getaddrinfo_unix(servname, hintp, result);