1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-13 10:02:38 +00:00

Make the libc_r version of select() set the readable or writable

file descriptor bit if poll() returns POLLERR, POLLHUP, or POLLNVAL.
Othewise, it's possible for select() to return successfully but
with no bits set.

Reviewed by:	deischen
MFC after:	3 days
PR:		bin/42175
This commit is contained in:
Archie Cobbs 2002-08-29 21:39:19 +00:00
parent 5bdfbf5afd
commit afa4625307
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=102586
3 changed files with 18 additions and 12 deletions

View File

@ -179,8 +179,9 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
got_events = 0;
if (readfds != NULL) {
if (FD_ISSET(data.fds[i].fd, readfds)) {
if (data.fds[i].revents & (POLLIN |
POLLRDNORM))
if ((data.fds[i].revents & (POLLIN
| POLLRDNORM | POLLERR
| POLLHUP | POLLNVAL)) != 0)
got_events++;
else
FD_CLR(data.fds[i].fd, readfds);
@ -188,8 +189,9 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
}
if (writefds != NULL) {
if (FD_ISSET(data.fds[i].fd, writefds)) {
if (data.fds[i].revents & (POLLOUT |
POLLWRNORM | POLLWRBAND))
if ((data.fds[i].revents & (POLLOUT
| POLLWRNORM | POLLWRBAND | POLLERR
| POLLHUP | POLLNVAL)) != 0)
got_events++;
else
FD_CLR(data.fds[i].fd,

View File

@ -179,8 +179,9 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
got_events = 0;
if (readfds != NULL) {
if (FD_ISSET(data.fds[i].fd, readfds)) {
if (data.fds[i].revents & (POLLIN |
POLLRDNORM))
if ((data.fds[i].revents & (POLLIN
| POLLRDNORM | POLLERR
| POLLHUP | POLLNVAL)) != 0)
got_events++;
else
FD_CLR(data.fds[i].fd, readfds);
@ -188,8 +189,9 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
}
if (writefds != NULL) {
if (FD_ISSET(data.fds[i].fd, writefds)) {
if (data.fds[i].revents & (POLLOUT |
POLLWRNORM | POLLWRBAND))
if ((data.fds[i].revents & (POLLOUT
| POLLWRNORM | POLLWRBAND | POLLERR
| POLLHUP | POLLNVAL)) != 0)
got_events++;
else
FD_CLR(data.fds[i].fd,

View File

@ -179,8 +179,9 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
got_events = 0;
if (readfds != NULL) {
if (FD_ISSET(data.fds[i].fd, readfds)) {
if (data.fds[i].revents & (POLLIN |
POLLRDNORM))
if ((data.fds[i].revents & (POLLIN
| POLLRDNORM | POLLERR
| POLLHUP | POLLNVAL)) != 0)
got_events++;
else
FD_CLR(data.fds[i].fd, readfds);
@ -188,8 +189,9 @@ _select(int numfds, fd_set * readfds, fd_set * writefds, fd_set * exceptfds,
}
if (writefds != NULL) {
if (FD_ISSET(data.fds[i].fd, writefds)) {
if (data.fds[i].revents & (POLLOUT |
POLLWRNORM | POLLWRBAND))
if ((data.fds[i].revents & (POLLOUT
| POLLWRNORM | POLLWRBAND | POLLERR
| POLLHUP | POLLNVAL)) != 0)
got_events++;
else
FD_CLR(data.fds[i].fd,