From: Eric Haszlakiewicz Date: Mon, 9 Sep 2019 02:27:30 +0000 (-0400) Subject: Issue #463: fix newlocale() call to use LC_NUMERIC_MASK instead of LC_NUMERIC, and... X-Git-Tag: json-c-0.14-20200419~87 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=374ffe87c61bff2a230cd84274fe3ca494da4017;p=json-c Issue #463: fix newlocale() call to use LC_NUMERIC_MASK instead of LC_NUMERIC, and remove incorrect comment. The second call to newlocale() with LC_TIME accidentally made things work because LC_TIME == LC_NUMERIC_MASK on some platforms. --- diff --git a/json_tokener.c b/json_tokener.c index 0096d5d..fc8fb65 100644 --- a/json_tokener.c +++ b/json_tokener.c @@ -265,14 +265,7 @@ struct json_object* json_tokener_parse_ex(struct json_tokener *tok, #ifdef HAVE_USELOCALE { locale_t duploc = duplocale(oldlocale); - newloc = newlocale(LC_NUMERIC, "C", duploc); - // XXX at least Debian 8.4 has a bug in newlocale where it doesn't - // change the decimal separator unless you set LC_TIME! - if (newloc) - { - duploc = newloc; // original duploc has been freed by newlocale() - newloc = newlocale(LC_TIME, "C", duploc); - } + newloc = newlocale(LC_NUMERIC_MASK, "C", duploc); if (newloc == NULL) { freelocale(duploc);