X-Git-Url: https://git.tcpdump.org/tcpdump/blobdiff_plain/f5fe14663d9ed32b7a995ed0924c04e705f74237..4c19cf87e5a4b2c1009819bc521860d581ac4003:/tcpdump.c diff --git a/tcpdump.c b/tcpdump.c index 1e8638a3..960a42f3 100644 --- a/tcpdump.c +++ b/tcpdump.c @@ -57,7 +57,11 @@ The Regents of the University of California. All rights reserved.\n"; #include #ifdef _WIN32 -#include "w32_fzs.h" +#ifndef _WINSOCKAPI_ +#define _WINSOCKAPI_ /* Prevent inclusion of winsock.h in windows.h */ +#endif /* _WINSOCKAPI_ */ +#include +#include extern int SIZE_BUF; #define off_t long #define uint UINT @@ -741,10 +745,6 @@ main(int argc, char **argv) netdissect_options Ndo; netdissect_options *ndo = &Ndo; -#ifdef _WIN32 - if(wsockinit() != 0) return 1; -#endif /* _WIN32 */ - memset(ndo, 0, sizeof(*ndo)); ndo->ndo_dlt=-1; ndo_set_function_pointers(ndo); @@ -764,6 +764,11 @@ main(int argc, char **argv) else ndo->program_name = program_name = argv[0]; +#ifdef _WIN32 + if (pcap_wsockinit() != 0) + error("Attempting to initialize Winsock failed"); +#endif /* _WIN32 */ + /* * On platforms where the CPU doesn't support unaligned loads, * force unaligned accesses to abort with SIGBUS, rather than