Mercurial > mplayer.hg
changeset 15213:4d8a0ecce6ac
check the result of poll() before read()ing; 100l
author | nicodvb |
---|---|
date | Mon, 18 Apr 2005 19:49:40 +0000 |
parents | 05aa13cdf92f |
children | 47027be213b2 |
files | libmpdemux/dvbin.c |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/libmpdemux/dvbin.c Mon Apr 18 15:52:38 2005 +0000 +++ b/libmpdemux/dvbin.c Mon Apr 18 19:49:40 2005 +0000 @@ -404,14 +404,8 @@ 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 @@ 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);