]> git.sesse.net Git - vlc/commitdiff
Use poll() instead of select() so we won't fall for the FD_SETSIZE trap
authorRémi Denis-Courmont <rem@videolan.org>
Fri, 28 Apr 2006 19:31:26 +0000 (19:31 +0000)
committerRémi Denis-Courmont <rem@videolan.org>
Fri, 28 Apr 2006 19:31:26 +0000 (19:31 +0000)
in any case (however unlikely we were to fall far it on Linux)

modules/access/pvr/pvr.c

index bab340c4f00031fd8c6e5b507db8879963802116..a37f2cd1cd8d2bb3e9f453f16c51bfed1d26f9a6 100644 (file)
@@ -35,6 +35,7 @@
 #include <errno.h>
 #include <linux/types.h>
 #include <sys/ioctl.h>
+#include <sys/poll.h>
 #include "videodev2.h"
 
 /*****************************************************************************
@@ -753,28 +754,22 @@ static int Read( access_t * p_access, uint8_t * p_buffer, int i_len )
     access_sys_t * p_sys = p_access->p_sys;
 
     int i_ret;
+    struct pollfd ufd;
 
-    struct timeval timeout;
-    fd_set fds;
-
-    FD_ZERO( &fds );
-    FD_SET( p_sys->i_fd, &fds );
-    timeout.tv_sec = 0;
-    timeout.tv_usec = 500000;
+    ufd.fd = fds;
+    ufd.events = POLLIN;
 
     if( p_access->info.b_eof )
         return 0;
 
-    while( !( i_ret = select( p_sys->i_fd + 1, &fds, NULL, NULL, &timeout) ) )
+    do
     {
-        FD_ZERO( &fds );
-        FD_SET( p_sys->i_fd, &fds );
-        timeout.tv_sec = 0;
-        timeout.tv_usec = 500000;
-
         if( p_access->b_die )
             return 0;
+
+        ufd.revents = 0;
     }
+    while( ( i_ret = poll( &ufd, 1, 500 ) ) == 0 );
 
     if( i_ret < 0 )
     {