summaryrefslogtreecommitdiffstats
path: root/lib/libpthread
diff options
context:
space:
mode:
authorarchie <archie@FreeBSD.org>2002-08-29 21:39:19 +0000
committerarchie <archie@FreeBSD.org>2002-08-29 21:39:19 +0000
commitaf2ae1a6ead6955227462a1da514280ecab1d181 (patch)
treeaa7dcc9cb64d129e3a4c13a9f90f8e4f0054aaa0 /lib/libpthread
parentc72f9f522eb030e55f95a5a07bfb06c8c594d513 (diff)
downloadFreeBSD-src-af2ae1a6ead6955227462a1da514280ecab1d181.zip
FreeBSD-src-af2ae1a6ead6955227462a1da514280ecab1d181.tar.gz
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
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/thread/thr_select.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libpthread/thread/thr_select.c b/lib/libpthread/thread/thr_select.c
index a3a9a9d..2776cb2 100644
--- a/lib/libpthread/thread/thr_select.c
+++ b/lib/libpthread/thread/thr_select.c
@@ -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,
OpenPOWER on IntegriCloud