fixed that select ignored invalid/not open sockets in the fd_sets (bug #50392)

This commit is contained in:
goldsimon 2017-02-24 19:48:59 +01:00
parent 01cc06bcb8
commit 3107d4a0fa
2 changed files with 10 additions and 1 deletions

View File

@ -26,6 +26,9 @@ HISTORY
++ Bugfixes:
2017-02-24: Simon Goldschmidt
* sockets.c: fixed that select ignored invalid/not open sockets in the fd_sets (bug #50392)
2017-02-16: Simon Goldschmidt
* LWIP_NETCONN_FULLDUPLEX: fixed shutdown during write (bug #50274)

View File

@ -1347,7 +1347,8 @@ lwip_selscan(int maxfdp1, fd_set *readset_in, fd_set *writeset_in, fd_set *excep
}
} else {
SYS_ARCH_UNPROTECT(lev);
/* continue on to next FD in list */
/* no a valid open socket */
return -1;
}
}
/* copy local sets to the ones provided as arguments */
@ -1384,6 +1385,11 @@ lwip_select(int maxfdp1, fd_set *readset, fd_set *writeset, fd_set *exceptset,
currently match */
nready = lwip_selscan(maxfdp1, readset, writeset, exceptset, &lreadset, &lwriteset, &lexceptset);
if (nready < 0) {
set_errno(EBADF);
return -1;
}
/* If we don't have any current events, then suspend if we are supposed to */
if (!nready) {
if (timeout && timeout->tv_sec == 0 && timeout->tv_usec == 0) {