Skip to content

Commit 6057748

Browse files
committed
casync-http: Log curl error code in acquire_file()
Signed-off-by: Arnaud Rebillout <[email protected]>
1 parent 1a29cdc commit 6057748

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/casync-http.c

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,7 @@ static char *chunk_url(const char *store_url, const CaChunkID *id) {
440440
}
441441

442442
static int acquire_file(CaRemote *rr, CURL *handle) {
443+
CURLcode c;
443444
long protocol_status;
444445
const char *url;
445446

@@ -448,15 +449,13 @@ static int acquire_file(CaRemote *rr, CURL *handle) {
448449

449450
log_debug("Acquiring %s...", url);
450451

451-
if (robust_curl_easy_perform(handle) != CURLE_OK) {
452-
log_error("Failed to acquire %s", url);
453-
return -EIO;
454-
}
452+
c = robust_curl_easy_perform(handle);
453+
if (c != CURLE_OK)
454+
return log_error_curle(c, "Failed to acquire %s", url);
455455

456-
if (curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &protocol_status) != CURLE_OK) {
457-
log_error("Failed to query response code");
458-
return -EIO;
459-
}
456+
c = curl_easy_getinfo(handle, CURLINFO_RESPONSE_CODE, &protocol_status);
457+
if (c != CURLE_OK)
458+
return log_error_curle(c, "Failed to query response code");
460459

461460
if (!protocol_status_ok(arg_protocol, protocol_status)) {
462461
_cleanup_free_ char *m = NULL;

0 commit comments

Comments
 (0)