diff options
author | Siggi Langauf <siggi@users.sourceforge.net> | 2002-01-04 02:17:02 +0000 |
---|---|---|
committer | Siggi Langauf <siggi@users.sourceforge.net> | 2002-01-04 02:17:02 +0000 |
commit | a104194527dad9e57b9736487d991a2e061dde43 (patch) | |
tree | 14f3baac7f12ee0ff48d2174d52e30783d51a7de /src | |
parent | 93c822dd5b372b6b4f933ab61877a2deb253047f (diff) | |
download | xine-lib-a104194527dad9e57b9736487d991a2e061dde43.tar.gz xine-lib-a104194527dad9e57b9736487d991a2e061dde43.tar.bz2 |
fixed read_block
CVS patchset: 1333
CVS date: 2002/01/04 02:17:02
Diffstat (limited to 'src')
-rw-r--r-- | src/input/input_net.c | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/src/input/input_net.c b/src/input/input_net.c index df8e8d2d2..320b66008 100644 --- a/src/input/input_net.c +++ b/src/input/input_net.c @@ -210,16 +210,25 @@ static int net_plugin_open (input_plugin_t *this_gen, char *mrl) { * */ static off_t net_plugin_read (input_plugin_t *this_gen, - char *buf, off_t nlen) { + char *buf, off_t len) { net_input_plugin_t *this = (net_input_plugin_t *) this_gen; - off_t n; - - n = read (this->fh, buf, nlen); - - if (n > 0) - this->curpos += n; - - return n; + off_t n, total; + + total=0; + while (total<len){ + n = read (this->fh, &buf[total], len-total); + /* + printf ("input_net: got %lld bytes (%lld/%lld bytes read)\n", + n,total,len); + */ + if (n > 0){ + this->curpos += n; + total += n; + } + else if (n<0 && errno!=EAGAIN) + return total; + } + return total; } static buf_element_t *net_plugin_read_block (input_plugin_t *this_gen, |