Cygwin: poll: Fix a bug on inquiring same fd with different events.
- poll() has a bug that it returns event which is not inquired if events are inquired in multiple pollfd entries on the same fd at the same time. This patch fixes the issue. Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251732.html
This commit is contained in:
parent
e7ffbdb018
commit
54930ae7d7
|
@ -104,7 +104,7 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout)
|
||||||
fds[i].revents = POLLHUP;
|
fds[i].revents = POLLHUP;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FD_ISSET(fds[i].fd, read_fds))
|
if ((fds[i].events & POLLIN) && FD_ISSET(fds[i].fd, read_fds))
|
||||||
/* This should be sufficient for sockets, too. Using
|
/* This should be sufficient for sockets, too. Using
|
||||||
MSG_PEEK, as before, can be considered dangerous at
|
MSG_PEEK, as before, can be considered dangerous at
|
||||||
best. Quote from W. Richard Stevens: "The presence
|
best. Quote from W. Richard Stevens: "The presence
|
||||||
|
@ -122,9 +122,11 @@ poll (struct pollfd *fds, nfds_t nfds, int timeout)
|
||||||
fds[i].revents |= (POLLIN | POLLERR);
|
fds[i].revents |= (POLLIN | POLLERR);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (FD_ISSET(fds[i].fd, write_fds))
|
if ((fds[i].events & POLLOUT)
|
||||||
|
&& FD_ISSET(fds[i].fd, write_fds))
|
||||||
fds[i].revents |= POLLOUT;
|
fds[i].revents |= POLLOUT;
|
||||||
if (FD_ISSET(fds[i].fd, except_fds))
|
if ((fds[i].events & POLLPRI)
|
||||||
|
&& FD_ISSET(fds[i].fd, except_fds))
|
||||||
fds[i].revents |= POLLPRI;
|
fds[i].revents |= POLLPRI;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,3 +17,8 @@ Bug Fixes
|
||||||
|
|
||||||
- Handle setting very long window title correctly in console.
|
- Handle setting very long window title correctly in console.
|
||||||
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251662.html
|
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251662.html
|
||||||
|
|
||||||
|
- Fix a bug of poll() that it returns event which is not inquired
|
||||||
|
if events are inquired in multiple pollfd entries on the same fd
|
||||||
|
at the same time.
|
||||||
|
Addresses: https://cygwin.com/pipermail/cygwin/2022-June/251732.html
|
||||||
|
|
Loading…
Reference in New Issue