diff options
author | Karl Williamson <khw@cpan.org> | 2021-04-12 05:08:10 -0600 |
---|---|---|
committer | Karl Williamson <khw@cpan.org> | 2022-08-18 07:57:30 -0600 |
commit | eb1c747cc5e636336d4c6f2c9abd88dd91269b59 (patch) | |
tree | 65c986f36b41bad1d15ba1c549b12927c5e2b4a3 /t/loc_tools.pl | |
parent | 63eccc74b3f1a706b7a219f15f42dd6650b20c4b (diff) | |
download | perl-eb1c747cc5e636336d4c6f2c9abd88dd91269b59.tar.gz |
t/loc_tools.pl: Add checks
This verifies that we can restore a locale that we were previously in,
and makes sure that we don't stay in a locale that doesn't work well.
Doing so has led to crashes.
Diffstat (limited to 't/loc_tools.pl')
-rw-r--r-- | t/loc_tools.pl | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/t/loc_tools.pl b/t/loc_tools.pl index 0b6962dbf4..8707fedcad 100644 --- a/t/loc_tools.pl +++ b/t/loc_tools.pl @@ -191,6 +191,10 @@ sub _trylocale ($$$$) { # For use only by other functions in this file! no locale; + # We definitely don't want the locale set to something that is + # unsupported + die "Couldn't restore locale '$save_locale', category $category" + unless setlocale($category, $save_locale); if ($badutf8) { _my_fail("Verify locale name doesn't contain malformed utf8"); return; @@ -646,7 +650,9 @@ sub find_utf8_turkic_locales (;$) { setlocale(&POSIX::LC_CTYPE(), $locale); push @return, $locale if uc('i') eq "\x{130}"; } - setlocale(&POSIX::LC_CTYPE(), $save_locale); + + die "Couldn't restore locale '$save_locale'" + unless setlocale(&POSIX::LC_CTYPE(), $save_locale); return @return; } |