From 7985205304ec02a23fa0e029ea40444c6a5a0163 Mon Sep 17 00:00:00 2001 From: =?utf8?q?R=C3=A9mi=20Denis-Courmont?= Date: Fri, 28 Apr 2006 19:31:26 +0000 Subject: [PATCH] Use poll() instead of select() so we won't fall for the FD_SETSIZE trap in any case (however unlikely we were to fall far it on Linux) --- modules/access/pvr/pvr.c | 21 ++++++++------------- 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/modules/access/pvr/pvr.c b/modules/access/pvr/pvr.c index bab340c4f0..a37f2cd1cd 100644 --- a/modules/access/pvr/pvr.c +++ b/modules/access/pvr/pvr.c @@ -35,6 +35,7 @@ #include #include #include +#include #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 ) { -- 2.39.5