lscpu: use locale-independent strtod() when read from kernel

Reported-by: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-05-25 11:32:51 +02:00
parent 670b10ae36
commit 0b538002da
1 changed files with 2 additions and 1 deletions

View File

@ -5,6 +5,7 @@
#include "lscpu.h"
#include "fileutils.h"
#include "c_strtod.h"
/* Lookup a pattern and get the value for format "<pattern> : <key>"
*/
@ -512,7 +513,7 @@ int lscpu_read_cpuinfo(struct lscpu_cxt *cxt)
pr->curr_type->bogomips = xstrdup(value);
if (pattern->id == PAT_MHZ && pr->curr_cpu && value) {
errno = 0;
pr->curr_cpu->mhz_cur_freq = strtof(value, NULL);
pr->curr_cpu->mhz_cur_freq = (float) c_strtod(value, NULL);
if (errno)
pr->curr_cpu->mhz_cur_freq = 0;
}