diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2012-01-18 15:13:21 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2012-01-18 15:13:21 +0000 |
| commit | 2a7daafe67dbd6a91ab557b56b2ca12ca87a6022 (patch) | |
| tree | a2005365ba56694fd925cd9d8f2687ea003a376f /lib/libfetch/http.c | |
| parent | ffce9a999dda9489933a511d264f71cd9e7e78b6 (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/http.c')
| -rw-r--r-- | lib/libfetch/http.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index b33d6f10dbc71..557ff26ebf941 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -196,6 +196,8 @@ http_growbuf(struct httpio *io, size_t len) static int http_fillbuf(struct httpio *io, size_t len) { + ssize_t nbytes; + if (io->error) return (-1); if (io->eof) @@ -204,10 +206,11 @@ http_fillbuf(struct httpio *io, size_t len) if (io->chunked == 0) { if (http_growbuf(io, len) == -1) return (-1); - if ((io->buflen = fetch_read(io->conn, io->buf, len)) == -1) { - io->error = 1; + if ((nbytes = fetch_read(io->conn, io->buf, len)) == -1) { + io->error = errno; return (-1); } + io->buflen = nbytes; io->bufpos = 0; return (io->buflen); } @@ -227,10 +230,11 @@ http_fillbuf(struct httpio *io, size_t len) len = io->chunksize; if (http_growbuf(io, len) == -1) return (-1); - if ((io->buflen = fetch_read(io->conn, io->buf, len)) == -1) { - io->error = 1; + if ((nbytes = fetch_read(io->conn, io->buf, len)) == -1) { + io->error = errno; return (-1); } + io->buflen = nbytes; io->chunksize -= io->buflen; if (io->chunksize == 0) { @@ -272,8 +276,11 @@ http_readfn(void *v, char *buf, int len) io->bufpos += l; } - if (!pos && io->error) + if (!pos && io->error) { + if (io->error == EINTR) + io->error = 0; return (-1); + } return (pos); } |
