lwip_selscan: lwip_selscan return -1 without setting errno number

Signed-off-by: Simon Goldschmidt <goldsimon@gmx.de>
This commit is contained in:
yuanjm 2021-01-28 21:00:37 +01:00 committed by Simon Goldschmidt
parent aca41b0beb
commit 066a2b022d

View File

@ -2072,7 +2072,9 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
/* Call lwip_selscan again: there could have been events between /* Call lwip_selscan again: there could have been events between
the last scan (without us on the list) and putting us on the list! */ the last scan (without us on the list) and putting us on the list! */
nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset); nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset);
if (!nready) { if (nready < 0) {
set_errno(EBADF);
} else if (!nready) {
/* Still none ready, just wait to be woken */ /* Still none ready, just wait to be woken */
if (timeout == 0) { if (timeout == 0) {
/* Wait forever */ /* Wait forever */
@ -2146,6 +2148,11 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
/* See what's set now after waiting */ /* See what's set now after waiting */
nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset); nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset);
LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: nready=%d\n", nready)); LWIP_DEBUGF(SOCKETS_DEBUG, ("lwip_select: nready=%d\n", nready));
if (nready < 0) {
set_errno(EBADF);
lwip_select_dec_sockets_used(maxfdp1, &used_sockets);
return -1;
}
} }
} }
} }