2006-09-27 Paul Eggert <eggert@cs.ucla.edu>
+ * canon-host.c (canon_host_r): Work around bug in Darwin 7.9.0
+ getaddrinfo.
+
* __fpending.h: Don't include <stdio_ext.h> unless
HAVE_DECL___FPENDING. This avoids a bug with lsbcc, where
it causes <stdio_ext.h> to cause a compile-time error.
status = getaddrinfo (host, NULL, &hints, &res);
if (!status)
{
- retval = strdup (res->ai_canonname);
+ /* http://lists.gnu.org/archive/html/bug-coreutils/2006-09/msg00300.html
+ says Darwin 7.9.0 getaddrinfo returns 0 but sets
+ res->ai_canonname to NULL. */
+ retval = strdup (res->ai_canonname ? res->ai_canonname : host);
if (!retval && cherror)
*cherror = EAI_MEMORY;
freeaddrinfo (res);