mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
Slight amendment to rev 1.34: instead of considering any short read an
error, only report an error if no data was read at all (unless len was 0 to start with). Otherwise, the final read of practically any transfer will end in a fatal error.
This commit is contained in:
parent
7ab4b95b67
commit
1a5424b137
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=106049
@ -384,12 +384,8 @@ _fetch_read(conn_t *conn, char *buf, size_t len)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
rlen = read(conn->sd, buf, len);
|
rlen = read(conn->sd, buf, len);
|
||||||
if (rlen == 0) {
|
if (rlen == 0)
|
||||||
/* we consider a short read a failure */
|
break;
|
||||||
errno = EPIPE;
|
|
||||||
_fetch_syserr();
|
|
||||||
return (-1);
|
|
||||||
}
|
|
||||||
if (rlen < 0) {
|
if (rlen < 0) {
|
||||||
if (errno == EINTR && fetchRestartCalls)
|
if (errno == EINTR && fetchRestartCalls)
|
||||||
continue;
|
continue;
|
||||||
@ -399,6 +395,12 @@ _fetch_read(conn_t *conn, char *buf, size_t len)
|
|||||||
buf += rlen;
|
buf += rlen;
|
||||||
total += rlen;
|
total += rlen;
|
||||||
}
|
}
|
||||||
|
if (total == 0 && len != 0) {
|
||||||
|
/* no data available at all */
|
||||||
|
errno = EPIPE;
|
||||||
|
_fetch_syserr();
|
||||||
|
return (-1);
|
||||||
|
}
|
||||||
return (total);
|
return (total);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user