1
0
mirror of https://github.com/moparisthebest/wget synced 2024-07-03 16:38:41 -04:00

[svn] Zero out sockaddr_in/sockaddr_in6. Apparently BSD-derived stacks need this

when binding a socket to local address.
This commit is contained in:
hniksic 2004-02-06 08:59:54 -08:00
parent 26dd99930e
commit 9adc7cf275
2 changed files with 8 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-02-06 Hrvoje Niksic <hniksic@xemacs.org>
* connect.c (sockaddr_set_data): Zero out
sockaddr_in/sockaddr_in6. Apparently BSD-derived stacks need this
when binding a socket to local address.
2004-02-04 Hrvoje Niksic <hniksic@xemacs.org> 2004-02-04 Hrvoje Niksic <hniksic@xemacs.org>
* hash.c: Make the file compilable outside Wget source tree when * hash.c: Make the file compilable outside Wget source tree when

View File

@ -87,6 +87,7 @@ sockaddr_set_data (struct sockaddr *sa, const ip_address *ip, int port)
case IPV4_ADDRESS: case IPV4_ADDRESS:
{ {
struct sockaddr_in *sin = (struct sockaddr_in *)sa; struct sockaddr_in *sin = (struct sockaddr_in *)sa;
xzero (*sin);
sin->sin_family = AF_INET; sin->sin_family = AF_INET;
sin->sin_port = htons (port); sin->sin_port = htons (port);
sin->sin_addr = ADDRESS_IPV4_IN_ADDR (ip); sin->sin_addr = ADDRESS_IPV4_IN_ADDR (ip);
@ -96,6 +97,7 @@ sockaddr_set_data (struct sockaddr *sa, const ip_address *ip, int port)
case IPV6_ADDRESS: case IPV6_ADDRESS:
{ {
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
xzero (*sin6);
sin6->sin6_family = AF_INET6; sin6->sin6_family = AF_INET6;
sin6->sin6_port = htons (port); sin6->sin6_port = htons (port);
sin6->sin6_addr = ADDRESS_IPV6_IN6_ADDR (ip); sin6->sin6_addr = ADDRESS_IPV6_IN6_ADDR (ip);