]> granicus.if.org Git - json-c/commitdiff
Issue #463: fix newlocale() call to use LC_NUMERIC_MASK instead of LC_NUMERIC, and...
authorEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 9 Sep 2019 02:27:30 +0000 (22:27 -0400)
committerEric Haszlakiewicz <erh+git@nimenees.com>
Mon, 9 Sep 2019 02:27:30 +0000 (22:27 -0400)
The second call to newlocale() with LC_TIME accidentally made things
 work because LC_TIME == LC_NUMERIC_MASK on some platforms.

json_tokener.c

index 0096d5d9c6498c3e0a1892907739f48c0c573f5c..fc8fb65f7eb8a663558add6f22fb1f87534e9c0e 100644 (file)
@@ -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);