aboutsummaryrefslogtreecommitdiff
path: root/libbb/xconnect.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libbb/xconnect.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index 3a0dc2653..ee54898e3 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -98,15 +98,15 @@ len_and_sockaddr* FAST_FUNC get_peer_lsa(int fd)
98 return get_lsa(fd, getpeername); 98 return get_lsa(fd, getpeername);
99} 99}
100 100
101void FAST_FUNC xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) 101void FAST_FUNC xconnect(int s, const struct sockaddr *saddr, socklen_t addrlen)
102{ 102{
103 if (connect(s, s_addr, addrlen) < 0) { 103 if (connect(s, saddr, addrlen) < 0) {
104 if (ENABLE_FEATURE_CLEAN_UP) 104 if (ENABLE_FEATURE_CLEAN_UP)
105 close(s); 105 close(s);
106 if (s_addr->sa_family == AF_INET) 106 if (saddr->sa_family == AF_INET)
107 bb_perror_msg_and_die("%s (%s)", 107 bb_perror_msg_and_die("%s (%s)",
108 "can't connect to remote host", 108 "can't connect to remote host",
109 inet_ntoa(((struct sockaddr_in *)s_addr)->sin_addr)); 109 inet_ntoa(((struct sockaddr_in *)saddr)->sin_addr));
110 bb_perror_msg_and_die("can't connect to remote host"); 110 bb_perror_msg_and_die("can't connect to remote host");
111 } 111 }
112} 112}
@@ -353,6 +353,10 @@ int FAST_FUNC xsocket_type(len_and_sockaddr **lsap, int family, int sock_type)
353#if ENABLE_FEATURE_IPV6 353#if ENABLE_FEATURE_IPV6
354 fd = socket(AF_INET6, sock_type, 0); 354 fd = socket(AF_INET6, sock_type, 0);
355 if (fd >= 0) { 355 if (fd >= 0) {
356#if ENABLE_PLATFORM_MINGW32
357 DWORD buffer = 0;
358 setsockopt(fd, IPPROTO_IPV6, IPV6_V6ONLY, &buffer, sizeof(DWORD));
359#endif
356 family = AF_INET6; 360 family = AF_INET6;
357 goto done; 361 goto done;
358 } 362 }