Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorinna Vinschen <corinna@vinschen.de>2013-11-19 22:07:46 +0400
committerCorinna Vinschen <corinna@vinschen.de>2013-11-19 22:07:46 +0400
commit0732e52c41ea6c49f786c0d6178cd17b26faf136 (patch)
tree61e7cd88fbf8606fe171132e7147606e2f7ebbb6 /winsup/cygwin/net.cc
parent705b50fe39c579e60849c0767037cc9683d4907e (diff)
* net.cc (cygwin_getaddrinfo): Fix a comment. Only memset whints if
hints is NULL. Add a comment and set whints.ai_family explicitely to AF_UNSPEC to follow glibc man page closely. Check flags against whints for locality.
Diffstat (limited to 'winsup/cygwin/net.cc')
-rw-r--r--winsup/cygwin/net.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/winsup/cygwin/net.cc b/winsup/cygwin/net.cc
index 141fa284e..bde6695cd 100644
--- a/winsup/cygwin/net.cc
+++ b/winsup/cygwin/net.cc
@@ -3294,9 +3294,8 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
| AI_NUMERICSERV | AI_ADDRCONFIG | AI_V4MAPPED
| AI_IDN_MASK)))
return EAI_BADFLAGS;
- /* AI_NUMERICSERV is not supported in our replacement getaddrinfo, nor
- is it supported by WinSock prior to Vista. We just check the servname
- parameter by ourselves here. */
+ /* AI_NUMERICSERV is not supported prior to Windows Vista. We just check
+ the servname parameter by ourselves here. */
if (hints && (hints->ai_flags & AI_NUMERICSERV))
{
char *p;
@@ -3341,9 +3340,13 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
return EAI_MEMORY;
}
- memset (&whints, 0, sizeof whints);
if (!hints)
- whints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
+ {
+ /* Default settings per glibc man page. */
+ memset (&whints, 0, sizeof whints);
+ whints.ai_family = PF_UNSPEC;
+ whints.ai_flags = AI_V4MAPPED | AI_ADDRCONFIG;
+ }
else
{
/* sizeof addrinfo == sizeof addrinfoW */
@@ -3355,8 +3358,8 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
apparently for performance reasons. To get the POSIX default
behaviour, the AI_ALL flag has to be set. */
if (wincap.supports_all_posix_ai_flags ()
- && hints->ai_family == PF_UNSPEC
- && !(hints->ai_flags & AI_ADDRCONFIG))
+ && whints.ai_family == PF_UNSPEC
+ && !(whints.ai_flags & AI_ADDRCONFIG))
whints.ai_flags |= AI_ALL;
}
/* Disable automatic IDN conversion on W8 and later. */