diff options
| author | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-10-27 17:20:49 +0000 |
|---|---|---|
| committer | Dag-Erling Smørgrav <des@FreeBSD.org> | 2002-10-27 17:20:49 +0000 |
| commit | 1a5424b13755f72a11dd8fd612bdd21ab218b886 (patch) | |
| tree | 935d7031b71b01a93eb8b3f699d776678316567f /lib/libfetch/common.c | |
| parent | 7ab4b95b67b6457dfae1e4d9802cbb486a21683b (diff) | |
Notes
Diffstat (limited to 'lib/libfetch/common.c')
| -rw-r--r-- | lib/libfetch/common.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index ab3f4ca144e6..1ae9193c1d6a 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -384,12 +384,8 @@ _fetch_read(conn_t *conn, char *buf, size_t len) else #endif rlen = read(conn->sd, buf, len); - if (rlen == 0) { - /* we consider a short read a failure */ - errno = EPIPE; - _fetch_syserr(); - return (-1); - } + if (rlen == 0) + break; if (rlen < 0) { if (errno == EINTR && fetchRestartCalls) continue; @@ -399,6 +395,12 @@ _fetch_read(conn_t *conn, char *buf, size_t len) buf += rlen; total += rlen; } + if (total == 0 && len != 0) { + /* no data available at all */ + errno = EPIPE; + _fetch_syserr(); + return (-1); + } return (total); } |
