From: Tom Lane Date: Sat, 24 Apr 2004 20:10:34 +0000 (+0000) Subject: Ensure getaddrinfo_all returns null result on failure. X-Git-Tag: REL8_0_0BETA1~765 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2ce964b958b553f362a38e9534f0434ea04bacc5;p=postgresql Ensure getaddrinfo_all returns null result on failure. --- diff --git a/src/backend/libpq/ip.c b/src/backend/libpq/ip.c index 790cf3254c..bc6a7b98d8 100644 --- a/src/backend/libpq/ip.c +++ b/src/backend/libpq/ip.c @@ -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);