getaddrinfo.h: handle undefined EAI_NODATA
authorJim Meyering <meyering@redhat.com>
Sat, 3 May 2008 09:46:58 +0000 (11:46 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 5 May 2008 12:12:27 +0000 (14:12 +0200)
* lib/getaddrinfo.h [!defined EAI_NODATA && defined EAI_NONAME]
(EAI_NODATA): Define.
* tests/test-getaddrinfo.c (EAI_NODATA): Don't define here.
This also reverts c9a6a9bb007294bb8878d685f3e9336b3a5be1ed.

lib/getaddrinfo.h
tests/test-getaddrinfo.c

index b4ef242..0e9aec1 100644 (file)
@@ -1,5 +1,5 @@
 /* Get address information.
-   Copyright (C) 1996-2002, 2003, 2004, 2005, 2006
+   Copyright (C) 1996-2002, 2003, 2004, 2005, 2006, 2008
                  Free Software Foundation, Inc.
    Contributed by Simon Josefsson <simon@josefsson.org>.
 
@@ -84,6 +84,14 @@ struct addrinfo
 # define EAI_SERVICE     -8    /* SERVICE not supported for `ai_socktype'.  */
 # define EAI_MEMORY      -10   /* Memory allocation failure.  */
 #endif
+
+/* Since EAI_NODATA is deprecated by RFC3493, some systems (at least
+   FreeBSD, which does define EAI_BADFLAGS) have removed the definition
+   in favor of EAI_NONAME.  */
+#if !defined EAI_NODATA && defined EAI_NONAME
+# define EAI_NODATA EAI_NONAME
+#endif
+
 #ifndef EAI_OVERFLOW
 /* Not defined on mingw32. */
 # define EAI_OVERFLOW    -12   /* Argument buffer overflow.  */
index 801bae8..8d487cb 100644 (file)
 # define EAI_SERVICE 0
 #endif
 
-#ifndef EAI_NODATA
-# define EAI_NODATA 0
-#endif
-
 int simple (char *host, char *service)
 {
   char buf[BUFSIZ];