[PATCH 2/2] qemu: fixing internationalization problem with sched kernel entry.

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

 



In qemuGetSchedInfo(), libvirt is trying to parse some field of /proc/*/sched.
Some fields are floating point numbers and their separator is always a dot.
When you change the locale of the system, you can change the mantissa
separator (to a comma separator) of floating point numbers and it affects the
parser.

This commit introduces the virStrToDoubleSafe() to avoid comma as a separator.

Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457634
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1457481

Signed-off-by: Julio Faracco <jcfaracco@xxxxxxxxx>
---
 src/qemu/qemu_driver.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index ba1dba5..f1b104f 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -1369,7 +1369,7 @@ qemuGetSchedInfo(unsigned long long *cpuWait,
             while (*line == ' ')
                 line++;
 
-            if (virStrToDouble(line, NULL, &val) < 0) {
+            if (virStrToDoubleSafe(line, NULL, &val) < 0) {
                 virReportError(VIR_ERR_INTERNAL_ERROR,
                                _("Unable to parse sched info value '%s'"),
                                line);
-- 
2.7.4

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[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