]> git.ipfire.org Git - pakfire.git/commitdiff
xfer: Receive any error messages from cURL
authorMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2023 19:04:38 +0000 (19:04 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 1 Nov 2023 19:04:38 +0000 (19:04 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/libpakfire/xfer.c

index e7f14ed422f4df59ce4909220abe6f0db15c95bc..b277ac8bca099a61747fdb0c71c39f9f4b2ae1b6 100644 (file)
@@ -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");