changeset 2092:995baffaa001 libavformat

fix FD_SETSIZE handling in our poll() emulation
author alex
date Mon, 21 May 2007 15:54:35 +0000
parents 659c9e8f558c
children 621b55f8eac4
files os_support.c
diffstat 1 files changed, 5 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/os_support.c	Mon May 21 08:33:36 2007 +0000
+++ b/os_support.c	Mon May 21 15:54:35 2007 +0000
@@ -139,6 +139,11 @@
     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 @@
     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);