mirror of
https://github.com/nmap/nmap.git
synced 2026-10-21 19:32:18 +00:00
Windows compatibility fix.
Initialize winsock before starting nsock test suite. Initial patch from Gisle Vanem.
This commit is contained in:
parent
0054b3ff4f
commit
456430c676
1 changed files with 16 additions and 0 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue