]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
esx: pass 'long' to curl_easy_setopt when needed
authorJán Tomko <jtomko@redhat.com>
Tue, 2 Sep 2025 12:04:40 +0000 (14:04 +0200)
committerJán Tomko <jtomko@redhat.com>
Mon, 8 Sep 2025 14:12:40 +0000 (16:12 +0200)
The include header got its type checks fixed in curl 8.14:
https://github.com/curl/curl/commit/79b4e56b3f30dc1ac28a81128a07d27338e5219e
https://github.com/curl/curl/pull/17143

This causes a warning on rawhide with clang:
../src/esx/esx_vi.c:318:5: error: call to '_curl_easy_setopt_err_long'
declared with 'warning' attribute: curl_easy_setopt expects a long
argument [-Werror,-Wattribute-warning]
  318 |     curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1);
      |     ^

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
src/esx/esx_stream.c
src/esx/esx_vi.c

index 14399403305cf2329ffb5e5a9fc80cd5c9dc7918..143b2405ed4961ac7a5d3730460396412d837135 100644 (file)
@@ -405,13 +405,13 @@ esxStreamOpen(virStreamPtr stream, esxPrivate *priv, const char *url,
         goto cleanup;
 
     if (mode == ESX_STREAM_MODE_UPLOAD) {
-        curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 1);
+        curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 1L);
         curl_easy_setopt(streamPriv->curl->handle, CURLOPT_READFUNCTION,
                          esxVI_CURL_ReadStream);
         curl_easy_setopt(streamPriv->curl->handle, CURLOPT_READDATA, streamPriv);
     } else {
-        curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 0);
-        curl_easy_setopt(streamPriv->curl->handle, CURLOPT_HTTPGET, 1);
+        curl_easy_setopt(streamPriv->curl->handle, CURLOPT_UPLOAD, 0L);
+        curl_easy_setopt(streamPriv->curl->handle, CURLOPT_HTTPGET, 1L);
         curl_easy_setopt(streamPriv->curl->handle, CURLOPT_WRITEFUNCTION,
                          esxVI_CURL_WriteStream);
         curl_easy_setopt(streamPriv->curl->handle, CURLOPT_WRITEDATA, streamPriv);
index d25f819bc51efff60d3dbfe619adbc21d1e4b46d..3264afc13a9c8f2f8e3a3ec34e7d9625ffc5493e 100644 (file)
@@ -315,13 +315,13 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
     }
 
     curl_easy_setopt(curl->handle, CURLOPT_USERAGENT, "libvirt-esx");
-    curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1);
-    curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0);
-    curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0);
+    curl_easy_setopt(curl->handle, CURLOPT_NOSIGNAL, 1L);
+    curl_easy_setopt(curl->handle, CURLOPT_HEADER, 0L);
+    curl_easy_setopt(curl->handle, CURLOPT_FOLLOWLOCATION, 0L);
     curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYPEER,
-                     parsedUri->noVerify ? 0 : 1);
+                     parsedUri->noVerify ? 0L : 1L);
     curl_easy_setopt(curl->handle, CURLOPT_SSL_VERIFYHOST,
-                     parsedUri->noVerify ? 0 : 2);
+                     parsedUri->noVerify ? 0L : 2L);
     curl_easy_setopt(curl->handle, CURLOPT_COOKIEFILE, "");
     curl_easy_setopt(curl->handle, CURLOPT_HTTPHEADER, curl->headers);
     curl_easy_setopt(curl->handle, CURLOPT_READFUNCTION,
@@ -331,16 +331,16 @@ esxVI_CURL_Connect(esxVI_CURL *curl, esxUtil_ParsedUri *parsedUri)
     curl_easy_setopt(curl->handle, CURLOPT_ERRORBUFFER, curl->error);
 #if ESX_VI__CURL__ENABLE_DEBUG_OUTPUT
     curl_easy_setopt(curl->handle, CURLOPT_DEBUGFUNCTION, esxVI_CURL_Debug);
-    curl_easy_setopt(curl->handle, CURLOPT_VERBOSE, 1);
+    curl_easy_setopt(curl->handle, CURLOPT_VERBOSE, 1L);
 #endif
 
     if (parsedUri->proxy) {
         curl_easy_setopt(curl->handle, CURLOPT_PROXY,
                          parsedUri->proxy_hostname);
         curl_easy_setopt(curl->handle, CURLOPT_PROXYTYPE,
-                         parsedUri->proxy_type);
+                         (long) parsedUri->proxy_type);
         curl_easy_setopt(curl->handle, CURLOPT_PROXYPORT,
-                         parsedUri->proxy_port);
+                         (long) parsedUri->proxy_port);
     }
 
     if (parsedUri->cacert)
@@ -386,8 +386,8 @@ esxVI_CURL_Download(esxVI_CURL *curl, const char *url, char **content,
         curl_easy_setopt(curl->handle, CURLOPT_URL, url);
         curl_easy_setopt(curl->handle, CURLOPT_RANGE, range);
         curl_easy_setopt(curl->handle, CURLOPT_WRITEDATA, &buffer);
-        curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 0);
-        curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1);
+        curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 0L);
+        curl_easy_setopt(curl->handle, CURLOPT_HTTPGET, 1L);
 
         responseCode = esxVI_CURL_Perform(curl, url);
     }
@@ -426,7 +426,7 @@ esxVI_CURL_Upload(esxVI_CURL *curl, const char *url, const char *content)
         curl_easy_setopt(curl->handle, CURLOPT_URL, url);
         curl_easy_setopt(curl->handle, CURLOPT_RANGE, NULL);
         curl_easy_setopt(curl->handle, CURLOPT_READDATA, &content);
-        curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 1);
+        curl_easy_setopt(curl->handle, CURLOPT_UPLOAD, 1L);
         curl_easy_setopt(curl->handle, CURLOPT_INFILESIZE, strlen(content));
 
         responseCode = esxVI_CURL_Perform(curl, url);
@@ -1223,7 +1223,7 @@ esxVI_Context_Execute(esxVI_Context *ctx, const char *methodName,
         curl_easy_setopt(ctx->curl->handle, CURLOPT_URL, ctx->url);
         curl_easy_setopt(ctx->curl->handle, CURLOPT_RANGE, NULL);
         curl_easy_setopt(ctx->curl->handle, CURLOPT_WRITEDATA, &buffer);
-        curl_easy_setopt(ctx->curl->handle, CURLOPT_UPLOAD, 0);
+        curl_easy_setopt(ctx->curl->handle, CURLOPT_UPLOAD, 0L);
         curl_easy_setopt(ctx->curl->handle, CURLOPT_POSTFIELDS, request);
         curl_easy_setopt(ctx->curl->handle, CURLOPT_POSTFIELDSIZE, strlen(request));