Protect EAI_NODATA with #ifdef. Fixes LM-120.
authorOwen Taylor <otaylor@redhat.com>
Mon, 25 Feb 2008 22:58:18 +0100
changeset 342 ea543fec7afd
parent 341 f44b206faf54
child 343 35a19649d773
Protect EAI_NODATA with #ifdef. Fixes LM-120. A recent change to GNU libc changes the EAI_NODATA constant in netdb.h to only be defined when _GNU_SOURCE is defined. A google for "loudmouth EAI_NODATA" indicates that EAI_NODATA is also problematical on FreeBSD. I'm attaching a patch that protects the usage of EAI_NODATA with an ifdef ... I think this is preferable to the sledgehammer of _GNU_SOURCE; while GNU libc can apparently still return this error value, using the default message in this rare corner case should not be a problem. committer: Mikael Hallendal <micke@imendio.com>
loudmouth/lm-sock.c
--- a/loudmouth/lm-sock.c	Mon Feb 25 22:52:41 2008 +0100
+++ b/loudmouth/lm-sock.c	Mon Feb 25 22:58:18 2008 +0100
@@ -279,9 +279,14 @@
 	case EAI_FAIL:     
 		return _("The nameserver encountered errors "
 			 "looking up this address");
+	/* EAI_NODATA is apparently missing on FreeBSD. On recent GNU libc,
+	 * it requires _GNU_SOURCE to be defined; in the unlikely case that
+	 * that GNU libc returns this value we'll return the default message */
+#ifdef EAI_NODATA
 	case EAI_NODATA:   
 		return _("The remote host exists but no address "
 			 "is available");
+#endif
 	case EAI_NONAME:   
 		return _("The remote address is unknown");
 	case EAI_FAMILY: