mirror of
https://github.com/nmap/nmap.git
synced 2026-06-26 03:03:55 +00:00
Windows compatibility fix.
Initialize winsock in ncat addrset test. Initial patch from Gisle Vanem.
This commit is contained in:
parent
64c706c260
commit
0054b3ff4f
1 changed files with 21 additions and 0 deletions
|
|
@ -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();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue