1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Nsock poll engine: notice HUP/ERR/NVAL on Windows. See #3138?

This commit is contained in:
dmiller
2025-06-25 00:47:44 +00:00
parent 3499025302
commit f2028a2007

View File

@@ -236,10 +236,7 @@ int poll_iod_register(struct npool *nsp, struct niod *iod, struct nevent *nse, i
pev->events |= POLL_R_FLAGS; pev->events |= POLL_R_FLAGS;
if (ev & EV_WRITE) if (ev & EV_WRITE)
pev->events |= POLL_W_FLAGS; pev->events |= POLL_W_FLAGS;
#ifndef WIN32 /* POLL_X_FLAGS are output-only. */
if (ev & EV_EXCEPT)
pev->events |= POLL_X_FLAGS;
#endif
} }
IOD_PROPSET(iod, IOD_REGISTERED); IOD_PROPSET(iod, IOD_REGISTERED);
@@ -379,7 +376,9 @@ int poll_loop(struct npool *nsp, int msec_timeout) {
* timeout) */ * timeout) */
combined_msecs = MIN((unsigned)event_msecs, (unsigned)msec_timeout); combined_msecs = MIN((unsigned)event_msecs, (unsigned)msec_timeout);
if (iod_count > 0) { assert(iod_count <= pinfo->used);
assert(pinfo->used < pinfo->max_idx);
if (iod_count > 0 && pinfo->used > 0) {
results_left = Poll(pinfo->events, pinfo->max_idx + 1, combined_msecs); results_left = Poll(pinfo->events, pinfo->max_idx + 1, combined_msecs);
if (results_left == -1) if (results_left == -1)
sock_err = socket_errno(); sock_err = socket_errno();
@@ -434,7 +433,7 @@ static inline int get_evmask(struct npool *nsp, struct niod *nsi) {
evmask |= EV_READ; evmask |= EV_READ;
if (pev->revents & POLL_W_FLAGS) if (pev->revents & POLL_W_FLAGS)
evmask |= EV_WRITE; evmask |= EV_WRITE;
if (pev->events && (pev->revents & POLL_X_FLAGS)) if (pev->revents & POLL_X_FLAGS)
evmask |= EV_EXCEPT; evmask |= EV_EXCEPT;
} }
return evmask; return evmask;