Module: Mesa
Branch: main
Commit: 27eafdcbd55b86b854db84c16c5919d7f9d3cda4
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=27eafdcbd55b86b854db84c16c5919d7f9d3cda4

Author: Thong Thai <[email protected]>
Date:   Tue Apr 25 16:12:53 2023 -0400

util: check and initialize locale before using it

Cc: mesa-stable

Signed-off-by: Thong Thai <[email protected]>
Acked-by: Marek Olšák <[email protected]>
Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22699>

---

 src/util/strtod.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/util/strtod.c b/src/util/strtod.c
index b42dc2e55b9..3f65eca93c0 100644
--- a/src/util/strtod.c
+++ b/src/util/strtod.c
@@ -69,6 +69,7 @@ double
 _mesa_strtod(const char *s, char **end)
 {
 #if defined(_GNU_SOURCE) && defined(HAVE_STRTOD_L)
+   if (!loc) _mesa_locale_init();
    return strtod_l(s, end, loc);
 #else
    return strtod(s, end);
@@ -84,6 +85,7 @@ float
 _mesa_strtof(const char *s, char **end)
 {
 #if defined(_GNU_SOURCE) && defined(HAVE_STRTOD_L)
+   if (!loc) _mesa_locale_init();
    return strtof_l(s, end, loc);
 #elif defined(HAVE_STRTOF)
    return strtof(s, end);

Reply via email to