]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
libvirt_nss_macs: Fix type of @len in findMACsFromJSON()
authorMichal Privoznik <mprivozn@redhat.com>
Wed, 21 May 2025 12:52:55 +0000 (14:52 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Thu, 22 May 2025 13:44:12 +0000 (15:44 +0200)
Inside of findMACsFromJSON(), the retval of
json_object_array_length() is stored in a variable that's type of
int. But the function is declared to return size_t:

  /usr/include/json-c/json_object.h:JSON_EXPORT size_t json_object_array_length(const struct json_object *obj);

Fix the type of the local variable.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
tools/nss/libvirt_nss_macs.c

index c3af9375bcb7e309ec01ff1c1a56dcc18b2b47db..44544624f37bf6276de5f30cd2a518747ca69248 100644 (file)
@@ -46,7 +46,7 @@ findMACsFromJSON(json_object *jobj,
                  size_t *nmacs)
 {
     size_t i;
-    int len;
+    size_t len;
 
     if (!json_object_is_type(jobj, json_type_array)) {
         ERROR("parsed JSON does not contain the leases array");