1
0
mirror of https://github.com/moparisthebest/curl synced 2025-02-28 09:21:50 -05:00

tool_operate: fixed potentially uninitialized variables

... in curl_easy_getinfo() calls. They're harmless but clearing the
variables makes the code safer and comforts the reader.

Closes #5416
This commit is contained in:
Siva Sivaraman 2020-05-18 08:59:47 -07:00 committed by Daniel Stenberg
parent 557dde201c
commit c4df1f75ad
No known key found for this signature in database
GPG Key ID: 5CC908FDB71E12C2

View File

@ -444,7 +444,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
RETRY_FTP,
RETRY_LAST /* not used */
} retry = RETRY_NO;
long response;
long response = 0;
if((CURLE_OPERATION_TIMEDOUT == result) ||
(CURLE_COULDNT_RESOLVE_HOST == result) ||
(CURLE_COULDNT_RESOLVE_PROXY == result) ||
@ -453,7 +453,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
retry = RETRY_TIMEOUT;
else if(config->retry_connrefused &&
(CURLE_COULDNT_CONNECT == result)) {
long oserrno;
long oserrno = 0;
curl_easy_getinfo(curl, CURLINFO_OS_ERRNO, &oserrno);
if(ECONNREFUSED == oserrno)
retry = RETRY_CONNREFUSED;
@ -464,7 +464,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
/* If it returned OK. _or_ failonerror was enabled and it
returned due to such an error, check for HTTP transient
errors to retry on. */
long protocol;
long protocol = 0;
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
if((protocol == CURLPROTO_HTTP) || (protocol == CURLPROTO_HTTPS)) {
/* This was HTTP(S) */
@ -492,7 +492,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
}
} /* if CURLE_OK */
else if(result) {
long protocol;
long protocol = 0;
curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &response);
curl_easy_getinfo(curl, CURLINFO_PROTOCOL, &protocol);
@ -589,7 +589,7 @@ static CURLcode post_per_transfer(struct GlobalConfig *global,
else if(per->metalink) {
/* Metalink: Decide to try the next resource or not. Try the next resource
if download was not successful. */
long response;
long response = 0;
if(CURLE_OK == result) {
/* TODO We want to try next resource when download was
not successful. How to know that? */