From 9f788e9c906554254bd1f32cfefaf244604575d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dag-Erling=20Sm=C3=B8rgrav?= Date: Sun, 27 Oct 2002 15:43:40 +0000 Subject: Eliminate two cases of undefined behaviour: total in _fetch_write() was not initialized before use, and _http_growbuf() did not return a value on success. Reported by: Peter Edwards MFC after: 2 weeks --- lib/libfetch/common.c | 1 + lib/libfetch/http.c | 1 + 2 files changed, 2 insertions(+) (limited to 'lib/libfetch') diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index df6d870e1e0f..48ac5d314324 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -465,6 +465,7 @@ _fetch_write(conn_t *conn, const char *buf, size_t len) timeout.tv_sec += fetchTimeout; } + total = 0; while (len > 0) { while (fetchTimeout && !FD_ISSET(conn->sd, &writefds)) { FD_SET(conn->sd, &writefds); diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 3afc5c75b98e..fe8262a4f9b5 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -179,6 +179,7 @@ _http_growbuf(struct httpio *io, size_t len) return (-1); io->buf = tmp; io->bufsize = len; + return (0); } /* -- cgit v1.2.3