c1e61bc
ISC libbind provides AI_ADDRCONFIG macro, but getaddrinfo() fails with
59baf46
EAI_BADFLAGS when invoked with it.  This patch retries getaddrinfo()
59baf46
without AI_ADDRCONFIG flag in this case.
59baf46
59baf46
It is very simple and a ./configure test for working AI_ADDRCONFIG
59baf46
might be better.
c1e61bc
c277bbd
Index: milter-greylist-4.2.5/spamd.c
c1e61bc
===================================================================
c277bbd
--- milter-greylist-4.2.5.orig/spamd.c
c277bbd
+++ milter-greylist-4.2.5/spamd.c
c1e61bc
@@ -454,11 +454,21 @@ spamd_inet_socket(host, port)
c1e61bc
 
c1e61bc
 	bzero(&hints, sizeof(hints));
c1e61bc
 	hints.ai_socktype = SOCK_STREAM;
c1e61bc
+
c1e61bc
 #ifdef AI_ADDRCONFIG
c1e61bc
 	hints.ai_flags = AI_ADDRCONFIG;
c1e61bc
+
c1e61bc
+again:
c1e61bc
+	e = getaddrinfo(host, port, &hints, &ai;;
c1e61bc
+	if (e == EAI_BADFLAGS && (hints.ai_flags & AI_ADDRCONFIG)) {
c1e61bc
+		hints.ai_flags &= ~AI_ADDRCONFIG;
c1e61bc
+		goto again;
c1e61bc
+	}
c1e61bc
+#else
c1e61bc
+	e = getaddrinfo(host, port, &hints, &ai;;
c1e61bc
 #endif
c1e61bc
 
c1e61bc
-	if ((e = getaddrinfo(host, port, &hints, &ai))) {
c1e61bc
+	if (e) {
c1e61bc
 		mg_log(LOG_ERR, 
c1e61bc
 		       "spamd getaddrinfo failed: %s", 
c1e61bc
 		       gai_strerror(e));