summaryrefslogtreecommitdiff
path: root/lib/libfetch
diff options
context:
space:
mode:
authorDag-Erling Smørgrav <des@FreeBSD.org>2002-10-30 04:43:00 +0000
committerDag-Erling Smørgrav <des@FreeBSD.org>2002-10-30 04:43:00 +0000
commitbb13d0af67c7a88c199b50cf826a38b9a65d74cb (patch)
treee25862669440f80763b6c261ff51830d303b2156 /lib/libfetch
parentcab84950921f9d6f9d0bd558132189fae9723759 (diff)
Notes
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 a2d319ca83db..75f1f308b7ea 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;