libc: honor poll() event flags POLLRDNORM etc.
Fixes empty read file-descriptor sets in fetchurl_lwip/lxip. Issue #3499
This commit is contained in:
parent
97df705e53
commit
291587f545
|
@ -1,6 +1,7 @@
|
||||||
/*
|
/*
|
||||||
* \brief poll() implementation
|
* \brief poll() implementation
|
||||||
* \author Josef Soentgen
|
* \author Josef Soentgen
|
||||||
|
* \author Christian Helmuth
|
||||||
* \author Emery Hemingway
|
* \author Emery Hemingway
|
||||||
* \date 2012-07-12
|
* \date 2012-07-12
|
||||||
*/
|
*/
|
||||||
|
@ -56,8 +57,7 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout)
|
||||||
for (i = 0; i < nfds; i++) {
|
for (i = 0; i < nfds; i++) {
|
||||||
fd = fds[i].fd;
|
fd = fds[i].fd;
|
||||||
if (fd >= (int)FD_SETSIZE) {
|
if (fd >= (int)FD_SETSIZE) {
|
||||||
/*errno = EINVAL;*/
|
return Libc::Errno(EINVAL);
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
maxfd = MAX(maxfd, fd);
|
maxfd = MAX(maxfd, fd);
|
||||||
}
|
}
|
||||||
|
@ -72,11 +72,11 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout)
|
||||||
fd = fds[i].fd;
|
fd = fds[i].fd;
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
continue;
|
continue;
|
||||||
if (fds[i].events & POLLIN) {
|
if (fds[i].events & (POLLIN | POLLPRI | POLLRDNORM | POLLRDBAND)) {
|
||||||
FD_SET(fd, &readfds);
|
FD_SET(fd, &readfds);
|
||||||
FD_SET(fd, &exceptfds);
|
FD_SET(fd, &exceptfds);
|
||||||
}
|
}
|
||||||
if (fds[i].events & POLLOUT) {
|
if (fds[i].events & (POLLOUT | POLLWRNORM | POLLWRBAND)) {
|
||||||
FD_SET(fd, &writefds);
|
FD_SET(fd, &writefds);
|
||||||
FD_SET(fd, &exceptfds);
|
FD_SET(fd, &exceptfds);
|
||||||
}
|
}
|
||||||
|
@ -89,7 +89,7 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout)
|
||||||
tvp = &tv;
|
tvp = &tv;
|
||||||
}
|
}
|
||||||
ret = select(maxfd + 1, &readfds, &writefds, &exceptfds, tvp);
|
ret = select(maxfd + 1, &readfds, &writefds, &exceptfds, tvp);
|
||||||
/*saved_errno = errno;*/
|
|
||||||
/* scan through select results and set poll() flags */
|
/* scan through select results and set poll() flags */
|
||||||
for (i = 0; i < nfds; i++) {
|
for (i = 0; i < nfds; i++) {
|
||||||
fd = fds[i].fd;
|
fd = fds[i].fd;
|
||||||
|
@ -107,10 +107,6 @@ poll(struct pollfd fds[], nfds_t nfds, int timeout)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
if (ret == -1)
|
|
||||||
errno = saved_errno;
|
|
||||||
*/
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue