From 7e0411b4647fea7bebfe7d15a0edf923b88c5e9c Mon Sep 17 00:00:00 2001 From: Jeffrey Stedfast Date: Fri, 24 Oct 2003 21:59:47 +0000 Subject: If the system defines AI_ADDRCONFIG, set this flag on the hints.ai_flags 2003-10-17 Jeffrey Stedfast * e-host-utils.c (e_gethostbyname_r): If the system defines AI_ADDRCONFIG, set this flag on the hints.ai_flags member as well so that we don't resolve a host to an IPv6 addr when the node doesn't have any IPv6 source addresses. svn path=/trunk/; revision=23077 --- e-util/e-host-utils.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'e-util/e-host-utils.c') diff --git a/e-util/e-host-utils.c b/e-util/e-host-utils.c index c4057113df..4ca2daa6dc 100644 --- a/e-util/e-host-utils.c +++ b/e-util/e-host-utils.c @@ -183,10 +183,14 @@ e_gethostbyname_r (const char *name, struct hostent *host, char *addr; memset (&hints, 0, sizeof (struct addrinfo)); +#ifdef HAVE_AI_ADDRCONFIG + hints.ai_flags = AI_CANONNAME | AI_ADDRCONFIG; +#else hints.ai_flags = AI_CANONNAME; +#endif hints.ai_family = PF_UNSPEC; - hints.ai_socktype = 0; - hints.ai_protocol = 0; + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; if ((retval = getaddrinfo (name, NULL, &hints, &res)) != 0) { *herr = ai_to_herr (retval); -- cgit v1.2.3