check the result of poll() before read()ing; 100l

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15214 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
nicodvb 2005-04-18 19:49:40 +00:00
parent dbb001bae2
commit cd57606202
1 changed files with 8 additions and 8 deletions

View File

@ -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);