diff options
author | des <des@FreeBSD.org> | 2002-06-19 08:36:00 +0000 |
---|---|---|
committer | des <des@FreeBSD.org> | 2002-06-19 08:36:00 +0000 |
commit | 07d27b9d0a6f77cfd05cc0a2a2b6a3b9446e32a9 (patch) | |
tree | 988eca4adb4de76a4a805d357345fe9ae1d1278f /lib/libfetch/http.c | |
parent | 2b21f1a948ddfc3597835e95b1709246d146b319 (diff) | |
download | FreeBSD-src-07d27b9d0a6f77cfd05cc0a2a2b6a3b9446e32a9.zip FreeBSD-src-07d27b9d0a6f77cfd05cc0a2a2b6a3b9446e32a9.tar.gz |
Don't try to dereference conn when we know it's NULL.
Diffstat (limited to 'lib/libfetch/http.c')
-rw-r--r-- | lib/libfetch/http.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/libfetch/http.c b/lib/libfetch/http.c index 68497e9..99b34ff 100644 --- a/lib/libfetch/http.c +++ b/lib/libfetch/http.c @@ -766,7 +766,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, conn_t *conn; struct url *url, *new; int chunked, direct, need_auth, noredirect, verbose; - int i, n; + int e, i, n; off_t offset, clength, length, size; time_t mtime; const char *p; @@ -793,6 +793,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, n = noredirect ? 1 : MAX_REDIRECT; i = 0; + e = HTTP_PROTOCOL_ERROR; need_auth = 0; do { new = NULL; @@ -990,6 +991,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, /* we need to provide authentication */ if (conn->err == HTTP_NEED_AUTH) { + e = conn->err; need_auth = 1; _fetch_close(conn); conn = NULL; @@ -997,6 +999,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, } /* all other cases: we got a redirect */ + e = conn->err; need_auth = 0; _fetch_close(conn); conn = NULL; @@ -1011,7 +1014,7 @@ _http_request(struct url *URL, const char *op, struct url_stat *us, /* we failed, or ran out of retries */ if (conn == NULL) { - _http_seterr(conn->err); + _http_seterr(e); goto ouch; } |