Windows compatibility fix.

Initialize winsock before starting nsock test suite.
Initial patch from Gisle Vanem.
This commit is contained in:
henri 2013-08-13 12:36:28 +00:00
parent 0054b3ff4f
commit 456430c676

View file

@ -69,9 +69,25 @@ static int test_case_run(const struct test_case *test) {
return test_teardown(test, tdata);
}
#ifdef WIN32
static int win_init(void) {
WSADATA data;
rc = WSAStartup(MAKEWORD(2, 2), &data);
if (rc)
fatal("Failed to start winsock: %s\n", socket_strerror(rc));
return 0;
}
#endif
int main(int ac, char **av) {
int rc, i;
#ifdef WIN32
win_init();
#endif
for (i = 0; TestCases[i] != NULL; i++) {
const struct test_case *current = TestCases[i];
const char *name = get_test_name(current);