From b34e416fa9d712bb4138911a2536ee709490d96b Mon Sep 17 00:00:00 2001 From: Nguyễn Thái Ngọc Duy Date: Wed, 15 Sep 2010 18:20:16 +1000 Subject: win32: add init_winsock() All network applets must call this function before using any winsock functions. --- win32/net.c | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'win32') diff --git a/win32/net.c b/win32/net.c index 93e19ae5c..82c29e57c 100644 --- a/win32/net.c +++ b/win32/net.c @@ -9,3 +9,12 @@ int inet_aton(const char *cp, struct in_addr *inp) inp->S_un.S_addr = val; return 1; } + +void init_winsock(void) +{ + WSADATA wsa; + if (WSAStartup(MAKEWORD(2,2), &wsa)) + bb_error_msg_and_die("unable to initialize winsock subsystem, error %d", + WSAGetLastError()); + atexit((void(*)(void)) WSACleanup); /* may conflict with other atexit? */ +} -- cgit v1.2.3-55-g6feb