]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Improving locale test
authorDmitry Belyavskiy <beldmit@gmail.com>
Fri, 29 Apr 2022 12:22:24 +0000 (14:22 +0200)
committerDmitry Belyavskiy <beldmit@gmail.com>
Mon, 2 May 2022 10:53:19 +0000 (12:53 +0200)
Fixes #18205

Reviewed-by: Paul Dale <pauli@openssl.org>
Reviewed-by: Tomas Mraz <tomas@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/18211)

test/localetest.c

index 3db66b7a9e5f08176ef1987a0726dcf27cae5d11..ea80039b3b88e1b0bf8717a8ba4a3deb9a308675 100644 (file)
@@ -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))