Skip to content

Commit

Permalink
Add error handling for curl_easy_getinfo
Browse files Browse the repository at this point in the history
Set response explicitly in case of curl_easy_getinfo error (though in
practice the response isn't modified and so program behavior is the
same as before this change).

Signed-off-by: William Douglas <[email protected]>
  • Loading branch information
bryteise committed Aug 12, 2024
1 parent 9fdf88c commit 069c4a6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/swupd_lib/curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,9 @@ enum download_status process_curl_error_codes(int curl_ret, CURL *curl_handle)
}
} else { /* download failed but let our caller do it */
long response = 0;
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &response);
if (curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &response) != CURLE_OK) {
response = -1; // Force error
}
debug("Curl - process_curl_error_codes: curl_ret = %d, response = %ld\n", curl_ret, response);
switch (response) {
case 403:
Expand Down

0 comments on commit 069c4a6

Please sign in to comment.