summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarmelo Amoroso <carmelo.amoroso@st.com>2008-03-05 14:29:49 +0000
committerCarmelo Amoroso <carmelo.amoroso@st.com>2008-03-05 14:29:49 +0000
commit450f89a3968091571e07d67518d4e64500292963 (patch)
tree010f2f9eb064f6bcbfe444eabcd8b9ebca6f118a
parent4517917f4b9e386f88bb856703963ddb8696aec4 (diff)
downloaduClibc-alpine-450f89a3968091571e07d67518d4e64500292963.tar.bz2
uClibc-alpine-450f89a3968091571e07d67518d4e64500292963.tar.xz
Synch with trunk adding latest changes:
- Added AI_NUMERICSERV flag and check if the string is not just a number when AI_NUMERICSERV flag set. Signed-off-by: Filippo Arcidiacono <filippo.arcidiacono@st.com> - Ricard Wanderlof writes: The following definitions in getaddrinfo.c seem redundant as they _are_ defined in the public netdb.h header, contrary to the comment. AI_DEFAULT is not, however it is not used in the file either so can be safely removed. Signed-off-by: Carmelo Amoroso <carmelo.amoroso@st.com>
-rw-r--r--libc/inet/getaddrinfo.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/libc/inet/getaddrinfo.c b/libc/inet/getaddrinfo.c
index 23a1e988e..d0d172643 100644
--- a/libc/inet/getaddrinfo.c
+++ b/libc/inet/getaddrinfo.c
@@ -90,15 +90,6 @@ libc_hidden_proto(__h_errno_location)
libc_hidden_proto(in6addr_loopback)
#endif
-/* The following declarations and definitions have been removed from
- * the public header since we don't want people to use them. */
-#define AI_V4MAPPED 0x0008 /* IPv4-mapped addresses are acceptable. */
-#define AI_ALL 0x0010 /* Return both IPv4 and IPv6 addresses. */
-#define AI_ADDRCONFIG 0x0020 /* Use configuration of this host to choose
- returned address type. */
-#define AI_DEFAULT (AI_V4MAPPED | AI_ADDRCONFIG)
-
-
#define GAIH_OKIFUNSPEC 0x0100
#define GAIH_EAI ~(GAIH_OKIFUNSPEC)
@@ -823,7 +814,7 @@ getaddrinfo (const char *name, const char *service,
hints = &default_hints;
if (hints->ai_flags & ~(AI_PASSIVE|AI_CANONNAME|AI_NUMERICHOST|
- AI_ADDRCONFIG|AI_V4MAPPED|AI_ALL))
+ AI_ADDRCONFIG|AI_V4MAPPED|AI_NUMERICSERV|AI_ALL))
return EAI_BADFLAGS;
if ((hints->ai_flags & AI_CANONNAME) && name == NULL)
@@ -834,8 +825,12 @@ getaddrinfo (const char *name, const char *service,
char *c;
gaih_service.name = service;
gaih_service.num = strtoul (gaih_service.name, &c, 10);
- if (*c)
+ if (*c != '\0') {
+ if (hints->ai_flags & AI_NUMERICSERV)
+ return EAI_NONAME;
+
gaih_service.num = -1;
+ }
else
/*
* Can't specify a numerical socket unless a protocol