summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authornicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-04-18 19:49:40 +0000
committernicodvb <nicodvb@b3059339-0415-0410-9bf9-f77b7e298cf2>2005-04-18 19:49:40 +0000
commitcd57606202358acf72e47e54458c372030175c77 (patch)
treef27ebc3278a0c9317d7edece76007348a90dcfbf /libmpdemux
parentdbb001bae23b18295014c9fc925538902f956c35 (diff)
downloadmpv-cd57606202358acf72e47e54458c372030175c77.tar.bz2
mpv-cd57606202358acf72e47e54458c372030175c77.tar.xz
check the result of poll() before read()ing; 100l
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15214 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/dvbin.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/libmpdemux/dvbin.c b/libmpdemux/dvbin.c
index 679370adff..5531b6098a 100644
--- a/libmpdemux/dvbin.c
+++ b/libmpdemux/dvbin.c
@@ -404,14 +404,8 @@ static int dvb_streaming_read(stream_t *stream, char *buffer, int size)
pfds[0].fd = fd;
pfds[0].events = POLLIN | POLLPRI;
- poll(pfds, 1, 500);
rk = size - pos;
- if((rk = read(fd, &buffer[pos], rk)) > 0)
- {
- pos += rk;
- mp_msg(MSGT_DEMUX, MSGL_DBG3, "ret (%d) bytes\n", pos);
- }
- else
+ if(poll(pfds, 1, 500) <= 0)
{
errno = 0;
mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_streaming_read, attempt N. %d failed with errno %d when reading %d bytes\n", tries, errno, size-pos);
@@ -419,8 +413,14 @@ static int dvb_streaming_read(stream_t *stream, char *buffer, int size)
continue;
else
break;
- }
}
+ if((rk = read(fd, &buffer[pos], rk)) > 0)
+ {
+ pos += rk;
+ mp_msg(MSGT_DEMUX, MSGL_DBG3, "ret (%d) bytes\n", pos);
+ }
+ }
+
if(! pos)
mp_msg(MSGT_DEMUX, MSGL_ERR, "dvb_streaming_read, return %d bytes\n", pos);