Skip to content

Commit

Permalink
Improving locale test
Browse files Browse the repository at this point in the history
Fixes #18205

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from #18211)
  • Loading branch information
beldmit committed May 2, 2022
1 parent 359dad5 commit 93983e5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/localetest.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,14 @@ int setup_tests(void)
X509_PUBKEY *cert_pubkey = NULL;
const unsigned char *p = der_bytes;

TEST_ptr(setlocale(LC_ALL, ""));
if (setlocale(LC_ALL, "") == NULL)
return TEST_skip("Cannot set the locale necessary for test");

res = strcasecmp(str1, str2);
TEST_note("Case-insensitive comparison via strcasecmp in current locale %s\n", res ? "failed" : "succeeded");

TEST_false(OPENSSL_strcasecmp(str1, str2));
if (!TEST_false(OPENSSL_strcasecmp(str1, str2)))
return 0;

cert = d2i_X509(NULL, &p, sizeof(der_bytes));
if (!TEST_ptr(cert))
Expand Down

0 comments on commit 93983e5

Please sign in to comment.