]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
lscpu: use locale-independent strtod() when read from kernel
authorKarel Zak <kzak@redhat.com>
Tue, 25 May 2021 09:32:51 +0000 (11:32 +0200)
committerKarel Zak <kzak@redhat.com>
Tue, 25 May 2021 09:32:51 +0000 (11:32 +0200)
Reported-by: Thomas Weißschuh
Signed-off-by: Karel Zak <kzak@redhat.com>
sys-utils/lscpu-cputype.c

index c2c1dc37632d7231eee4e011a8a9e339d37586c0..023b56ee99d64893db95f1913dd6549b6681f580 100644 (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;
                        }