From ba6b2865caee98a973cfbb959ed8ebd82f4d74d2 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Wed, 27 Sep 2006 18:25:47 +0000 Subject: [PATCH] * canon-host.c (canon_host_r): Work around bug in Darwin 7.9.0 getaddrinfo. --- lib/ChangeLog | 3 +++ lib/canon-host.c | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/ChangeLog b/lib/ChangeLog index 4393e2bbe..2844e7c37 100644 --- a/lib/ChangeLog +++ b/lib/ChangeLog @@ -1,5 +1,8 @@ 2006-09-27 Paul Eggert + * canon-host.c (canon_host_r): Work around bug in Darwin 7.9.0 + getaddrinfo. + * __fpending.h: Don't include unless HAVE_DECL___FPENDING. This avoids a bug with lsbcc, where it causes to cause a compile-time error. diff --git a/lib/canon-host.c b/lib/canon-host.c index c0b7c1344..c29f31431 100644 --- a/lib/canon-host.c +++ b/lib/canon-host.c @@ -69,7 +69,10 @@ canon_host_r (char const *host, int *cherror) 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); -- 2.11.0