From f8f3fd44d84a83c9e8e9bb383b54cd866d512f72 Mon Sep 17 00:00:00 2001 From: des Date: Wed, 30 Oct 2002 04:43:00 +0000 Subject: Recommit the non-broken parts of 1.34 and 1.37. Change the type and name of a variable introduced in 1.33. --- lib/libfetch/common.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'lib/libfetch/common.c') 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; -- cgit v1.1