Apply for Mac OS too.

This commit is contained in:
klaas
2022-04-05 10:29:26 +00:19
parent e7d09a31a4
commit 3772aa312b

View File

@@ -122,7 +122,7 @@ static const unsigned char
*(*f_pcap_next)(void *,void *); *(*f_pcap_next)(void *,void *);
static int (*f_pcap_sendpacket)(void *,const unsigned char *,int); static int (*f_pcap_sendpacket)(void *,const unsigned char *,int);
static void (*f_pcap_close)(void *); static void (*f_pcap_close)(void *);
#ifdef __linux__ #ifndef _WIN32
static int (*f_pcap_setnonblock)(void*, int, char*); static int (*f_pcap_setnonblock)(void*, int, char*);
#endif #endif
static dllimp_t pcap_imports[] = { static dllimp_t pcap_imports[] = {
@@ -135,7 +135,7 @@ static dllimp_t pcap_imports[] = {
{ "pcap_next", &f_pcap_next }, { "pcap_next", &f_pcap_next },
{ "pcap_sendpacket", &f_pcap_sendpacket }, { "pcap_sendpacket", &f_pcap_sendpacket },
{ "pcap_close", &f_pcap_close }, { "pcap_close", &f_pcap_close },
#ifdef __linux__ #ifndef _WIN32
{ "pcap_setnonblock", &f_pcap_setnonblock }, { "pcap_setnonblock", &f_pcap_setnonblock },
#endif #endif
{ NULL, NULL }, { NULL, NULL },
@@ -388,7 +388,7 @@ net_pcap_reset(const netcard_t *card, uint8_t *mac)
pcap_log(" Unable to open device: %s!\n", network_host); pcap_log(" Unable to open device: %s!\n", network_host);
return(-1); return(-1);
} }
#ifdef __linux__ #ifndef _WIN32
if (f_pcap_setnonblock((void*)pcap, 1, errbuf) != 0) if (f_pcap_setnonblock((void*)pcap, 1, errbuf) != 0)
pcap_log("PCAP: failed nonblock %s\n", errbuf); pcap_log("PCAP: failed nonblock %s\n", errbuf);
#endif #endif