summaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authorKarl Williamson <khw@cpan.org>2018-02-15 04:22:19 -0700
committerKarl Williamson <khw@cpan.org>2018-02-18 09:02:08 -0700
commit8fc14efc8e8ce14fba31220281badcf4cfa4ce42 (patch)
tree9991ef017409fd4adb2881d2702af9fa0e19906e /ext
parent54bedd20db9aabcd966a04c09154743e84d3016f (diff)
downloadperl-8fc14efc8e8ce14fba31220281badcf4cfa4ce42.tar.gz
POSIX.xs: Fix localeconv_l()
Commit 7d5966ae3c3b8f0e43fa09554a46cb8de9c98f5f added use of localeconv_l(). But this commit is buggy in some locales. It needs to find the current locale AFTER any changes have been made due to the LC_NUMERIC locale toggling.
Diffstat (limited to 'ext')
-rw-r--r--ext/POSIX/POSIX.xs3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/POSIX/POSIX.xs b/ext/POSIX/POSIX.xs
index 1dbcd076e4..2d3e69f1ab 100644
--- a/ext/POSIX/POSIX.xs
+++ b/ext/POSIX/POSIX.xs
@@ -2128,7 +2128,7 @@ localeconv()
&& defined(HAS_POSIX_2008_LOCALE) \
&& defined(HAS_LOCALECONV_L) /* Prefer this thread-safe version */
bool do_free = FALSE;
- locale_t cur = uselocale((locale_t) 0);
+ locale_t cur;
# endif
DECLARATION_FOR_LC_NUMERIC_MANIPULATION;
@@ -2153,6 +2153,7 @@ localeconv()
&& defined(HAS_POSIX_2008_LOCALE) \
&& defined(HAS_LOCALECONV_L)
+ cur = uselocale((locale_t) 0);
if (cur == LC_GLOBAL_LOCALE) {
cur = duplocale(LC_GLOBAL_LOCALE);
do_free = TRUE;