From: Michael Tremer Date: Wed, 1 Nov 2023 19:04:38 +0000 (+0000) Subject: xfer: Receive any error messages from cURL X-Git-Tag: 0.9.30~1325 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f48f3d0997cc11c3935ac31c3f4a0ed0e837d93b;p=pakfire.git xfer: Receive any error messages from cURL Signed-off-by: Michael Tremer --- diff --git a/src/libpakfire/xfer.c b/src/libpakfire/xfer.c index e7f14ed42..b277ac8bc 100644 --- a/src/libpakfire/xfer.c +++ b/src/libpakfire/xfer.c @@ -97,6 +97,9 @@ struct pakfire_xfer { // Authentication unsigned int auth; + + // Space for cURL error message + char error[CURL_ERROR_SIZE]; }; static void pakfire_xfer_free(struct pakfire_xfer* xfer) { @@ -242,6 +245,11 @@ static int pakfire_xfer_setup(struct pakfire_xfer* xfer) { curl_easy_setopt(xfer->handle, CURLOPT_DEBUGDATA, xfer->ctx); #endif + // Set error buffer + r = curl_easy_setopt(xfer->handle, CURLOPT_ERRORBUFFER, xfer->error); + if (r) + goto ERROR; + // Limit protocols to HTTPS, HTTP, FTP and FILE curl_easy_setopt(xfer->handle, CURLOPT_PROTOCOLS_STR, "HTTPS,HTTP,FTP,FILE");