s4: Fix a getaddrinfo/EAI_NODATA portability issue
authorTim Prouty <tprouty@samba.org>
Mon, 22 Dec 2008 23:04:10 +0000 (15:04 -0800)
committerTim Prouty <tprouty@samba.org>
Mon, 22 Dec 2008 23:15:16 +0000 (15:15 -0800)
FreeBSD has explicitly deprecated EAI_NODATA as a return value from
getaddrinfo by removing it from netdb.h.  On systems that don't have
EAI_NODATA, EAI_NONAME should be used instead.

source4/libcli/resolve/dns_ex.c

index 948ad9f134e90744ff76090089bd24dfb3e13df6..17e7aad290b279b9fa6b433f152cbc25dd5e7c9a 100644 (file)
@@ -278,7 +278,11 @@ static void run_child_getaddrinfo(struct dns_ex_state *state, int fd)
        hints.ai_flags = AI_ADDRCONFIG | AI_NUMERICSERV;
 
        ret = getaddrinfo(state->name.name, "0", &hints, &res_list);
+#if defined(EAI_NODATA) && (EAI_NODATA != EAI_NONAME)
        if (ret == EAI_NODATA && state->do_fallback) {
+#else
+       if (ret == EAI_NONAME && state->do_fallback) {
+#endif
                /* getaddrinfo() doesn't handle CNAME records */
                run_child_dns_lookup(state, fd);
                return;