]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
ch: Fix printf format strings wrt size_t argument
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 3 Apr 2025 10:02:14 +0000 (12:02 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Fri, 4 Apr 2025 13:30:26 +0000 (15:30 +0200)
In a few places, when a size_t typed argument is passed to a
printf-like function the corresponding specifier is %ld instead
of %zu. Fix those places.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
src/ch/ch_monitor.c
src/ch/ch_process.c

index 1c2c1f285804ae1ca996531f5bf6f4cac44a2b39..78b6551d6cbf740ca74dfe8c0c051b6f90df0aa7 100644 (file)
@@ -156,7 +156,7 @@ virCHMonitorBuildPayloadJson(virJSONValue *content, virDomainDef *vmdef)
             buf = g_base64_decode(vmdef->sec->data.sev_snp.host_data, &len);
             if (len != host_data_len) {
                 virReportError(VIR_ERR_CONFIG_UNSUPPORTED,
-                               _("Invalid host_data provided. Expected '%1$ld' bytes"),
+                               _("Invalid host_data provided. Expected '%1$zu' bytes"),
                                host_data_len);
                 return -1;
             }
@@ -1139,7 +1139,7 @@ virCHMonitorBuildRestoreJson(virDomainDef *vmdef,
         g_autoptr(virJSONValue) nets = virJSONValueNewArray();
         for (i = 0; i < vmdef->nnets; i++) {
             g_autoptr(virJSONValue) net_json = virJSONValueNewObject();
-            g_autofree char *id = g_strdup_printf("%s_%ld", CH_NET_ID_PREFIX, i);
+            g_autofree char *id = g_strdup_printf("%s_%zu", CH_NET_ID_PREFIX, i);
             if (virJSONValueObjectAppendString(net_json, "id", id) < 0)
                 return -1;
             if (virJSONValueObjectAppendNumberInt(net_json, "num_fds", vmdef->nets[i]->driver.virtio.queues))
index a008b5275269cd75af495bd0f7e8092700e98a80..95c808cb41c8519b76e87d606e8c71072f21541a 100644 (file)
@@ -701,7 +701,7 @@ chProcessAddNetworkDevices(virCHDriver *driver,
         VIR_DEBUG("payload sent with net-add request to CH = %s", payload);
 
         virBufferAsprintf(&buf, "%s", virBufferCurrentContent(&http_headers));
-        virBufferAsprintf(&buf, "Content-Length: %ld\r\n\r\n", strlen(payload));
+        virBufferAsprintf(&buf, "Content-Length: %zu\r\n\r\n", strlen(payload));
         virBufferAsprintf(&buf, "%s", payload);
         payload_len = virBufferUse(&buf);
         payload = virBufferContentAndReset(&buf);
@@ -1130,7 +1130,7 @@ virCHProcessStartRestore(virCHDriver *driver, virDomainObj *vm, const char *from
     virBufferAddLit(&http_headers, "Host: localhost\r\n");
     virBufferAddLit(&http_headers, "Content-Type: application/json\r\n");
     virBufferAsprintf(&buf, "%s", virBufferCurrentContent(&http_headers));
-    virBufferAsprintf(&buf, "Content-Length: %ld\r\n\r\n", strlen(payload));
+    virBufferAsprintf(&buf, "Content-Length: %zu\r\n\r\n", strlen(payload));
     virBufferAsprintf(&buf, "%s", payload);
     payload_len = virBufferUse(&buf);
     payload = virBufferContentAndReset(&buf);