* net.cc (cygwin_getaddrinfo): Fix value of hint->ai_addrlen on 64 bit.
Explain why.
This commit is contained in:
parent
9c54570beb
commit
4ea38ac7ef
@ -1,3 +1,8 @@
|
|||||||
|
2014-06-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
|
* net.cc (cygwin_getaddrinfo): Fix value of hint->ai_addrlen on 64 bit.
|
||||||
|
Explain why.
|
||||||
|
|
||||||
2014-06-23 Corinna Vinschen <corinna@vinschen.de>
|
2014-06-23 Corinna Vinschen <corinna@vinschen.de>
|
||||||
|
|
||||||
* environ.cc (regopt): Allocate small local buffer to avoid copying
|
* environ.cc (regopt): Allocate small local buffer to avoid copying
|
||||||
|
@ -3366,6 +3366,11 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
|
|||||||
/* sizeof addrinfo == sizeof addrinfoW */
|
/* sizeof addrinfo == sizeof addrinfoW */
|
||||||
memcpy (&whints, hints, sizeof whints);
|
memcpy (&whints, hints, sizeof whints);
|
||||||
whints.ai_flags &= ~AI_IDN_MASK;
|
whints.ai_flags &= ~AI_IDN_MASK;
|
||||||
|
#ifdef __x86_64__
|
||||||
|
/* ai_addrlen is socklen_t (4 bytes) in POSIX but size_t (8 bytes) in
|
||||||
|
Winsock. Sert upper 4 bytes explicitely to 0 to avoid EAI_FAIL. */
|
||||||
|
whints.ai_addrlen &= UINT32_MAX;
|
||||||
|
#endif
|
||||||
/* AI_ADDRCONFIG is not supported prior to Vista. Rather it's
|
/* AI_ADDRCONFIG is not supported prior to Vista. Rather it's
|
||||||
the default and only possible setting.
|
the default and only possible setting.
|
||||||
On Vista, the default behaviour is as if AI_ADDRCONFIG is set,
|
On Vista, the default behaviour is as if AI_ADDRCONFIG is set,
|
||||||
@ -3402,6 +3407,11 @@ cygwin_getaddrinfo (const char *hostname, const char *servname,
|
|||||||
/* sizeof addrinfo == sizeof addrinfoW */
|
/* sizeof addrinfo == sizeof addrinfoW */
|
||||||
memcpy (&whints, hints, sizeof whints);
|
memcpy (&whints, hints, sizeof whints);
|
||||||
whints.ai_family = AF_INET;
|
whints.ai_family = AF_INET;
|
||||||
|
#ifdef __x86_64__
|
||||||
|
/* ai_addrlen is socklen_t (4 bytes) in POSIX but size_t (8 bytes) in
|
||||||
|
Winsock. Sert upper 4 bytes explicitely to 0 to avoid EAI_FAIL. */
|
||||||
|
whints.ai_addrlen &= UINT32_MAX;
|
||||||
|
#endif
|
||||||
int ret2 = w32_to_gai_err (GetAddrInfoW (whost, wserv, &whints, &wres));
|
int ret2 = w32_to_gai_err (GetAddrInfoW (whost, wserv, &whints, &wres));
|
||||||
if (!ret2)
|
if (!ret2)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user