From: Pavel Hrdina Date: Thu, 27 Jun 2024 16:05:18 +0000 (+0200) Subject: vircgroup: fix g_variant_new_parsed format string causing abort X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=67fdc636bfa14df6e72981717777f1f1aef2a987;p=libvirt.git vircgroup: fix g_variant_new_parsed format string causing abort The original code was incorrect and never tested because at the time of implementing it the cgroup file `io.weight` was not available. Resolves: https://issues.redhat.com/browse/RHEL-45185 Introduced-by: 9c1693eff427661616ce1bd2795688f87288a412 Signed-off-by: Pavel Hrdina Reviewed-by: Jiri Denemark --- diff --git a/src/util/vircgroupv1.c b/src/util/vircgroupv1.c index 77c7e209ce..c1f0562249 100644 --- a/src/util/vircgroupv1.c +++ b/src/util/vircgroupv1.c @@ -1225,7 +1225,7 @@ virCgroupV1SetBlkioDeviceWeight(virCgroup *group, if (group->unitName) { GVariant *value = NULL; - value = g_variant_new_parsed("[(%s, uint64 %u)]", path, weight); + value = g_variant_new_parsed("[(%s, %t)]", path, weight); return virCgroupSetValueDBus(group->unitName, "BlockIODeviceWeight", value); } else { diff --git a/src/util/vircgroupv2.c b/src/util/vircgroupv2.c index db115e25f7..eaf5ae98f6 100644 --- a/src/util/vircgroupv2.c +++ b/src/util/vircgroupv2.c @@ -867,7 +867,7 @@ virCgroupV2SetBlkioDeviceWeight(virCgroup *group, if (group->unitName) { GVariant *value = NULL; - value = g_variant_new_parsed("[(%s, uint64 %u)]", path, weight); + value = g_variant_new_parsed("[(%s, %t)]", path, weight); return virCgroupSetValueDBus(group->unitName, "IODeviceWeight", value); } else {