Set ai_addrlen even if there is no sa_len.

This commit is contained in:
Martin v. Löwis 2001-07-21 18:48:56 +00:00
parent 2d8d4276c6
commit c7cdc63755
1 changed files with 1 additions and 0 deletions

View File

@ -188,6 +188,7 @@ if (pai->ai_flags & AI_CANONNAME) {\
memcpy(ai, pai, sizeof(struct addrinfo));\ memcpy(ai, pai, sizeof(struct addrinfo));\
(ai)->ai_addr = (struct sockaddr *)((ai) + 1);\ (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
memset((ai)->ai_addr, 0, (gai_afd)->a_socklen);\ memset((ai)->ai_addr, 0, (gai_afd)->a_socklen);\
(ai)->ai_addrlen = (gai_afd)->a_socklen;\
(ai)->ai_addr->sa_family = (ai)->ai_family = (gai_afd)->a_af;\ (ai)->ai_addr->sa_family = (ai)->ai_family = (gai_afd)->a_af;\
((struct sockinet *)(ai)->ai_addr)->si_port = port;\ ((struct sockinet *)(ai)->ai_addr)->si_port = port;\
p = (char *)((ai)->ai_addr);\ p = (char *)((ai)->ai_addr);\