Always wait for both threads to finish
authorRich Salz <rsalz@akamai.com>
Thu, 10 Jun 2021 20:06:10 +0000 (16:06 -0400)
committerMatt Caswell <matt@openssl.org>
Wed, 16 Jun 2021 14:43:48 +0000 (15:43 +0100)
Reviewed-by: Tomas Mraz <tomas@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
Reviewed-by: Paul Dale <pauli@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/15708)

test/threadstest.c

index cb9817aa28a7828abdf48b44a970e4538232e551..ce31738189cbf5eef5c148bf4bcf495e71186fc5 100644 (file)
@@ -441,12 +441,16 @@ static int test_multi(int idx)
 
     worker();
 
-    if (!TEST_true(wait_for_thread(thread1))
-            || !TEST_true(wait_for_thread(thread2))
-            || !TEST_true(multi_success))
-        goto err;
-
     testresult = 1;
+    /*
+     * Don't combine these into one if statement; must wait for both threads.
+     */
+    if (!TEST_true(wait_for_thread(thread1)))
+        testresult = 0;
+    if (!TEST_true(wait_for_thread(thread2)))
+        testresult = 0;
+    if (!TEST_true(multi_success))
+        testresult = 0;
 
  err:
     EVP_MD_free(sha256);