1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2025-01-13 21:28:01 +02:00

fix FD_SETSIZE handling in our poll() emulation

Originally committed as revision 9095 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
Alex Beregszaszi 2007-05-21 15:54:35 +00:00
parent 6f9a35bb35
commit 7235183df9

View File

@ -139,6 +139,11 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
int n; int n;
int rc; int rc;
if (numfds >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
FD_ZERO(&read_set); FD_ZERO(&read_set);
FD_ZERO(&write_set); FD_ZERO(&write_set);
FD_ZERO(&exception_set); FD_ZERO(&exception_set);
@ -147,10 +152,6 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout)
for(i = 0; i < numfds; i++) { for(i = 0; i < numfds; i++) {
if (fds[i].fd < 0) if (fds[i].fd < 0)
continue; continue;
if (fds[i].fd >= FD_SETSIZE) {
errno = EINVAL;
return -1;
}
if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set); if (fds[i].events & POLLIN) FD_SET(fds[i].fd, &read_set);
if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set); if (fds[i].events & POLLOUT) FD_SET(fds[i].fd, &write_set);