diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2014-01-29 12:48:19 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2014-01-29 12:48:19 +0000 |
| commit | 9c1ca3a1dd4f199495e3892856e0ecfa16c1918d (patch) | |
| tree | 71f230a25a643d802e1398567dd0f1028de6ca8b /lib/libfetch/http.c | |
| parent | cc47735350dad9f6f9be743df4ec4e2958ebf846 (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/http.c')
| -rw-r--r-- | lib/libfetch/http.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index fc43a97fbdb1..676cbb76d960 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -204,7 +204,7 @@ http_growbuf(struct httpio *io, size_t len) /* * Fill the input buffer, do chunk decoding on the fly */ -static int +static ssize_t http_fillbuf(struct httpio *io, size_t len) { ssize_t nbytes; @@ -230,7 +230,7 @@ http_fillbuf(struct httpio *io, size_t len) if (io->chunksize == 0) { switch (http_new_chunk(io)) { case -1: - io->error = 1; + io->error = EPROTO; return (-1); case 0: io->eof = 1; @@ -276,10 +276,12 @@ http_readfn(void *v, char *buf, int len) /* empty buffer */ if (!io->buf || io->bufpos == io->buflen) { - if (http_fillbuf(io, len) < 1) { - if (io->error == EINTR) + if ((rlen = http_fillbuf(io, len)) < 0) { + if ((errno = io->error) == EINTR) io->error = 0; return (-1); + } else if (rlen == 0) { + return (0); } } |
