Skip to content

Commit

Permalink
t/loc_tools.pl: Add checks
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
khwilliamson committed May 5, 2021
1 parent d45f941 commit a09181f
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion t/loc_tools.pl
Expand Up @@ -178,6 +178,10 @@ ($$$$)

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;
Expand Down Expand Up @@ -642,7 +646,9 @@ (;$)
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;
}
Expand Down

0 comments on commit a09181f

Please sign in to comment.