[PATCH 1/2] virSystemdCreateMachine: Use proper format string for uint64_t when constructing gvariant

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



g_variant_new_parsed uses '%t' for a uint64_t rather than printf-like
%llu. Additionally ensure that the passed value is a uint64_t since the
argument used is a 'unsigned int'.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1937287
Fixes: bf5f2ed09c2
Signed-off-by: Peter Krempa <pkrempa@xxxxxxxxxx>
---
 src/util/virsystemd.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/util/virsystemd.c b/src/util/virsystemd.c
index c109324e96..c22f2df866 100644
--- a/src/util/virsystemd.c
+++ b/src/util/virsystemd.c
@@ -519,11 +519,12 @@ int virSystemdCreateMachine(const char *name,
     }

     if (maxthreads > 0) {
+        uint64_t max = maxthreads;
+
         if (!(scopename = virSystemdMakeScopeName(name, drivername, false)))
             return -1;

-        gprops = g_variant_new_parsed("[('TasksMax', <%llu>)]",
-                                      (uint64_t)maxthreads);
+        gprops = g_variant_new_parsed("[('TasksMax', <%t>)]", max);

         message = g_variant_new("(sb@a(sv))",
                                 scopename,
-- 
2.29.2




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux