mirror of
https://github.com/nmap/nmap.git
synced 2025-12-31 11:59:03 +00:00
Windows compatibility fix.
Initialize winsock in ncat addrset test. Initial patch from Gisle Vanem.
This commit is contained in:
@@ -22,6 +22,23 @@
|
||||
|
||||
#include "ncat_core.h"
|
||||
|
||||
#ifdef WIN32
|
||||
#include "../nsock/error.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIN32
|
||||
static void win_init(void)
|
||||
{
|
||||
WSADATA data;
|
||||
int rc;
|
||||
|
||||
rc = WSAStartup(MAKEWORD(2,2), &data);
|
||||
if (rc)
|
||||
fatal("failed to start winsock: %s\n", socket_strerror(rc));
|
||||
}
|
||||
#endif
|
||||
|
||||
static int resolve_name(const char *name, struct addrinfo **result)
|
||||
{
|
||||
struct addrinfo hints = { 0 };
|
||||
@@ -38,6 +55,10 @@ int main(int argc, char *argv[])
|
||||
char line[1024];
|
||||
int i;
|
||||
|
||||
#ifdef WIN32
|
||||
win_init();
|
||||
#endif
|
||||
|
||||
addrset_init(&set);
|
||||
|
||||
options_init();
|
||||
|
||||
Reference in New Issue
Block a user