On 16/04/2014 18:55, Marco Atzeri wrote:
> On 16/04/2014 17:40, Tom Lane wrote:
>
>> The bigger picture though is that this code isn't failing on the
>> buildfarm. So what we need to ask is what's different about Marco's
>> machine.
>
> good question.
> I checked again and I found that the fault is only on
> the cygwin 64 bit build but not on the cygwin 32 bit one.
>
> I was sure to have tested both, but it seems this time
> I missed the comparison.
>
>> regards, tom lane
>
> Regards
> Marco
>
to close the issue, we have identified the fault in the getaddrinfo
system call on cygwin64.
"What happens is that the field ai_addrlen is defined as socklen_t in
POSIX, but as size_t in the W32 API. On 64 bit, socklen_t is 4 bytes
while size_t is 8 bytes.
Setting all the hintp members manually (in
contrast to calloc'ing it or memset'ing it to 0) leaves the 4 upper
bytes of the ai_addrlen untouched. This in turn leads to a high
probability that ai_addrlen has an invalid value when entering
Winsock's getsockopt."
Regards
Marco