mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-15 22:51:13 -03:00
fallback: Set LC_ALL in wcstod_l fallback
Apparently some wcstod's don't care about LC_NUMERIC.
This commit is contained in:
@@ -395,7 +395,12 @@ int flock(int fd, int op) {
|
||||
// thread-specific locale.
|
||||
double fish_compat::wcstod_l(const wchar_t *enptr, wchar_t **endptr, locale_t loc) {
|
||||
// Create and use a new, thread-specific locale
|
||||
locale_t locale = newlocale(LC_NUMERIC, "C", nullptr);
|
||||
// NOTE: We use "C" whatever the passed locale,
|
||||
// and we use the LC_ALL category.
|
||||
//
|
||||
// Empirically, this fails on OpenIndiana/Illumos/Solaris/SunOS if using LC_NUMERIC.
|
||||
// Since we reset it afterwards, it shouldn't matter.
|
||||
locale_t locale = newlocale(LC_ALL, "C", nullptr);
|
||||
locale_t prev_locale = uselocale(locale);
|
||||
double ret = wcstod(enptr, endptr);
|
||||
// Restore the old locale before freeing the locale we created and are still using
|
||||
|
||||
Reference in New Issue
Block a user