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:
parent
670b10ae36
commit
0b538002da
|
@ -5,6 +5,7 @@
|
||||||
#include "lscpu.h"
|
#include "lscpu.h"
|
||||||
|
|
||||||
#include "fileutils.h"
|
#include "fileutils.h"
|
||||||
|
#include "c_strtod.h"
|
||||||
|
|
||||||
/* Lookup a pattern and get the value for format "<pattern> : <key>"
|
/* 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);
|
pr->curr_type->bogomips = xstrdup(value);
|
||||||
if (pattern->id == PAT_MHZ && pr->curr_cpu && value) {
|
if (pattern->id == PAT_MHZ && pr->curr_cpu && value) {
|
||||||
errno = 0;
|
errno = 0;
|
||||||
pr->curr_cpu->mhz_cur_freq = strtof(value, NULL);
|
pr->curr_cpu->mhz_cur_freq = (float) c_strtod(value, NULL);
|
||||||
if (errno)
|
if (errno)
|
||||||
pr->curr_cpu->mhz_cur_freq = 0;
|
pr->curr_cpu->mhz_cur_freq = 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue