aboutsummaryrefslogtreecommitdiff
path: root/libbb/xconnect.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-27 20:15:49 +1000
committerNguyễn Thái Ngọc Duy <pclouds@gmail.com>2009-04-28 14:31:59 +1000
commit087b73d87ebab807ba38e2d543756ac2bc17becc (patch)
tree46dcd5e936d72cc56b1af15c5be5c2c3696b412b /libbb/xconnect.c
parent1756cc5943aa545f2f18fff60d56ad0886ef6145 (diff)
downloadbusybox-w32-087b73d87ebab807ba38e2d543756ac2bc17becc.tar.gz
busybox-w32-087b73d87ebab807ba38e2d543756ac2bc17becc.tar.bz2
busybox-w32-087b73d87ebab807ba38e2d543756ac2bc17becc.zip
libbb/xconnect: initialize winsock before using it
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);