diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2007-05-21 15:54:35 +0000 |
---|---|---|
committer | Alex Beregszaszi <alex@rtfs.hu> | 2007-05-21 15:54:35 +0000 |
commit | 7235183df92d1267f8b4a5ac2a73ed4d700163b7 (patch) | |
tree | 5642790a73bd3f2e9be8926ea9594d5c0ecf2d9e /libavformat/os_support.c | |
parent | 6f9a35bb352e74d381773f27c875c4baa04dde6b (diff) | |
download | ffmpeg-7235183df92d1267f8b4a5ac2a73ed4d700163b7.tar.gz |
fix FD_SETSIZE handling in our poll() emulation
Originally committed as revision 9095 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/os_support.c')
-rw-r--r-- | libavformat/os_support.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libavformat/os_support.c b/libavformat/os_support.c index bcb62b8528..b70dc2755b 100644 --- a/libavformat/os_support.c +++ b/libavformat/os_support.c @@ -139,6 +139,11 @@ int poll(struct pollfd *fds, nfds_t numfds, int timeout) int n; int rc; + if (numfds >= FD_SETSIZE) { + errno = EINVAL; + return -1; + } + FD_ZERO(&read_set); FD_ZERO(&write_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++) { if (fds[i].fd < 0) 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 & POLLOUT) FD_SET(fds[i].fd, &write_set); |