summaryrefslogtreecommitdiffstats
path: root/lib/libfetch
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2002-10-30 04:43:00 +0000
committerdes <des@FreeBSD.org>2002-10-30 04:43:00 +0000
commitf8f3fd44d84a83c9e8e9bb383b54cd866d512f72 (patch)
treee25862669440f80763b6c261ff51830d303b2156 /lib/libfetch
parent007c9b98dac84bdb0aaa1ae942543c8a35ffc2c3 (diff)
downloadFreeBSD-src-f8f3fd44d84a83c9e8e9bb383b54cd866d512f72.zip
FreeBSD-src-f8f3fd44d84a83c9e8e9bb383b54cd866d512f72.tar.gz
Recommit the non-broken parts of 1.34 and 1.37.
Change the type and name of a variable introduced in 1.33.
Diffstat (limited to 'lib/libfetch')
-rw-r--r--lib/libfetch/common.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c
index a2d319c..75f1f30 100644
--- a/lib/libfetch/common.c
+++ b/lib/libfetch/common.c
@@ -364,13 +364,17 @@ _fetch_read(conn_t *conn, char *buf, size_t len)
wait.tv_usec += 1000000;
wait.tv_sec--;
}
- if (wait.tv_sec < 0)
- return (rlen);
+ if (wait.tv_sec < 0) {
+ errno = ETIMEDOUT;
+ _fetch_syserr();
+ return (-1);
+ }
errno = 0;
r = select(conn->sd + 1, &readfds, NULL, NULL, &wait);
if (r == -1) {
if (errno == EINTR && fetchRestartCalls)
continue;
+ _fetch_syserr();
return (-1);
}
}
@@ -405,8 +409,8 @@ _fetch_getln(conn_t *conn)
{
char *tmp;
size_t tmpsize;
+ ssize_t len;
char c;
- int error;
if (conn->buf == NULL) {
if ((conn->buf = malloc(MIN_BUF_SIZE)) == NULL) {
@@ -420,10 +424,10 @@ _fetch_getln(conn_t *conn)
conn->buflen = 0;
do {
- error = _fetch_read(conn, &c, 1);
- if (error == -1)
+ len = _fetch_read(conn, &c, 1);
+ if (len == -1)
return (-1);
- else if (error == 0)
+ if (len == 0)
break;
conn->buf[conn->buflen++] = c;
if (conn->buflen == conn->bufsize) {
@@ -488,6 +492,7 @@ _fetch_writev(conn_t *conn, struct iovec *iov, int iovcnt)
}
if (wait.tv_sec < 0) {
errno = ETIMEDOUT;
+ _fetch_syserr();
return (-1);
}
errno = 0;
OpenPOWER on IntegriCloud