From be51f2652b95b8b7b8778039c012d0c9c70741a0 Mon Sep 17 00:00:00 2001 From: Simon Josefsson Date: Wed, 17 Feb 2010 09:19:03 +0100 Subject: [PATCH] netdb.h: Define AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG when needed. --- ChangeLog | 6 ++++++ lib/netdb.in.h | 28 +++++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 1609f879c7..b3d0853854 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-02-17 Simon Josefsson + + * lib/netdb.in.h (AI_V4MAPPED, AI_ALL, AI_ADDRCONFIG): Define to 0 + if not provided by the system's netdb.h. Reported by + ludo@gnu.org (Ludovic Courtès). + 2010-02-15 Jim Meyering maint.mk: mark syntax-check sc_*.m rules as .PHONY diff --git a/lib/netdb.in.h b/lib/netdb.in.h index 6f3695bd87..def9b5f799 100644 --- a/lib/netdb.in.h +++ b/lib/netdb.in.h @@ -74,18 +74,24 @@ struct addrinfo # endif # if 0 -/* The commented out definitions below are not yet implemented in the - GNULIB getaddrinfo() replacement, so are not yet needed and may, in fact, - cause conflicts on systems with a getaddrinfo() function which does not - define them. - - If they are restored, be sure to protect the definitions with #ifndef. */ # define AI_NUMERICHOST 0x0004 /* Don't use name resolution. */ -# define AI_V4MAPPED 0x0008 /* IPv4 mapped addresses are acceptable. */ -# define AI_ALL 0x0010 /* Return IPv4 mapped and IPv6 addresses. */ -# define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose - returned address type.. */ -# endif /* 0 */ +# endif + +/* These symbolic constants are required to be present by POSIX, but + our getaddrinfo replacement doesn't use them (yet). Setting them + to 0 on systems that doesn't have them avoids causing problems for + system getaddrinfo implementations that would be confused by + unknown values. */ +# ifndef AI_V4MAPPED +# define AI_V4MAPPED 0 /* 0x0008: IPv4 mapped addresses are acceptable. */ +# endif +# ifndef AI_ALL +# define AI_ALL 0 /* 0x0010: Return IPv4 mapped and IPv6 addresses. */ +# endif +# ifndef AI_ADDRCONFIG +# define AI_ADDRCONFIG 0 /* 0x0020: Use configuration of this host to choose + returned address type.. */ +# endif /* Error values for `getaddrinfo' function. */ # ifndef EAI_BADFLAGS -- 2.30.2