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

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



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 gmail com>
---
 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


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