[libvirt PATCH] esx: pass 'long' to curl_easy_setopt when needed

Ján Tomko via Devel posted 1 patch 4 days, 14 hours ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/79db1a222064516044842523c3dbda3da2f68ab1.1756816444.git.jtomko@redhat.com
src/esx/esx_stream.c |  6 +++---
src/esx/esx_vi.c     | 24 ++++++++++++------------
2 files changed, 15 insertions(+), 15 deletions(-)
[libvirt PATCH] esx: pass 'long' to curl_easy_setopt when needed
Posted by Ján Tomko via Devel 4 days, 14 hours ago
From: Ján Tomko <jtomko@redhat.com>

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>
---
 src/esx/esx_stream.c |  6 +++---
 src/esx/esx_vi.c     | 24 ++++++++++++------------
 2 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/esx/esx_stream.c b/src/esx/esx_stream.c
index 1439940330..143b2405ed 100644
--- a/src/esx/esx_stream.c
+++ b/src/esx/esx_stream.c
@@ -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);
diff --git a/src/esx/esx_vi.c b/src/esx/esx_vi.c
index d25f819bc5..3264afc13a 100644
--- a/src/esx/esx_vi.c
+++ b/src/esx/esx_vi.c
@@ -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));
 
-- 
2.50.1