aboutsummaryrefslogtreecommitdiff
path: root/libbb/xconnect.c
diff options
context:
space:
mode:
Diffstat (limited to 'libbb/xconnect.c')
-rw-r--r--libbb/xconnect.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libbb/xconnect.c b/libbb/xconnect.c
index e7d510678..6e9b29298 100644
--- a/libbb/xconnect.c
+++ b/libbb/xconnect.c
@@ -6,7 +6,14 @@
6 * 6 *
7 */ 7 */
8 8
9#ifdef __MINGW32__
10#define WINVER 0x0501
11#include <winsock2.h>
12#include <ws2tcpip.h>
13#undef s_addr
14#else
9#include <netinet/in.h> 15#include <netinet/in.h>
16#endif
10#include "libbb.h" 17#include "libbb.h"
11 18
12int setsockopt_reuseaddr(int fd) 19int setsockopt_reuseaddr(int fd)
@@ -162,6 +169,7 @@ USE_FEATURE_IPV6(sa_family_t af,)
162 * for each possible socket type (tcp,udp,raw...): */ 169 * for each possible socket type (tcp,udp,raw...): */
163 hint.ai_socktype = SOCK_STREAM; 170 hint.ai_socktype = SOCK_STREAM;
164 hint.ai_flags = ai_flags & ~DIE_ON_ERROR; 171 hint.ai_flags = ai_flags & ~DIE_ON_ERROR;
172 winsock_init();
165 rc = getaddrinfo(host, NULL, &hint, &result); 173 rc = getaddrinfo(host, NULL, &hint, &result);
166 if (rc || !result) { 174 if (rc || !result) {
167 bb_error_msg("bad address '%s'", org_host); 175 bb_error_msg("bad address '%s'", org_host);