1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-19 05:59:01 +00:00

[NSOCK] Sandwitched pcap_read_on_nonselect() statements between #ifndef

PCAP_CAN_DO_SELECT guards to prevent them from being executed on systems that
actually provide selectable pcap descriptors.
This commit is contained in:
henri
2012-07-17 16:38:15 +00:00
parent db594ed246
commit a111b5bcdc
2 changed files with 8 additions and 0 deletions

View File

@@ -109,8 +109,10 @@ static void iterate_through_event_lists(mspool *nsp, int evcount);
void process_iod_events(mspool *nsp, msiod *nsi, int ev); void process_iod_events(mspool *nsp, msiod *nsi, int ev);
void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev); void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev);
#if HAVE_PCAP #if HAVE_PCAP
#ifndef PCAP_CAN_DO_SELECT
int pcap_read_on_nonselect(mspool *nsp); int pcap_read_on_nonselect(mspool *nsp);
#endif #endif
#endif
/* defined in nsock_event.c */ /* defined in nsock_event.c */
void update_first_events(msevent *nse); void update_first_events(msevent *nse);
@@ -280,11 +282,13 @@ int epoll_loop(mspool *nsp, int msec_timeout) {
combined_msecs = MIN((unsigned)event_msecs, (unsigned)msec_timeout); combined_msecs = MIN((unsigned)event_msecs, (unsigned)msec_timeout);
#if HAVE_PCAP #if HAVE_PCAP
#ifndef PCAP_CAN_DO_SELECT
/* do non-blocking read on pcap devices that doesn't support select() /* do non-blocking read on pcap devices that doesn't support select()
* If there is anything read, just leave this loop. */ * If there is anything read, just leave this loop. */
if (pcap_read_on_nonselect(nsp)) { if (pcap_read_on_nonselect(nsp)) {
/* okay, something was read. */ /* okay, something was read. */
} else } else
#endif
#endif #endif
{ {
if (einfo->evlen) if (einfo->evlen)

View File

@@ -126,8 +126,10 @@ void process_event(mspool *nsp, gh_list *evlist, msevent *nse, int ev);
void process_iod_events(mspool *nsp, msiod *nsi, int ev); void process_iod_events(mspool *nsp, msiod *nsi, int ev);
#if HAVE_PCAP #if HAVE_PCAP
#ifndef PCAP_CAN_DO_SELECT
int pcap_read_on_nonselect(mspool *nsp); int pcap_read_on_nonselect(mspool *nsp);
#endif #endif
#endif
/* defined in nsock_event.c */ /* defined in nsock_event.c */
void update_first_events(msevent *nse); void update_first_events(msevent *nse);
@@ -315,11 +317,13 @@ int select_loop(mspool *nsp, int msec_timeout) {
} }
#if HAVE_PCAP #if HAVE_PCAP
#ifndef PCAP_CAN_DO_SELECT
/* do non-blocking read on pcap devices that doesn't support select() /* do non-blocking read on pcap devices that doesn't support select()
* If there is anything read, just leave this loop. */ * If there is anything read, just leave this loop. */
if (pcap_read_on_nonselect(nsp)) { if (pcap_read_on_nonselect(nsp)) {
/* okay, something was read. */ /* okay, something was read. */
} else } else
#endif
#endif #endif
{ {
/* Set up the descriptors for select */ /* Set up the descriptors for select */