[compiler-rt] eb33a7a - [test][sanitizer] Check pthread_create return value

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Mon May 8 00:43:19 PDT 2023


Author: Vitaly Buka
Date: 2023-05-08T00:31:41-07:00
New Revision: eb33a7ac765a1e67e2ee51a4f6883986802ac3a0

URL: https://github.com/llvm/llvm-project/commit/eb33a7ac765a1e67e2ee51a4f6883986802ac3a0
DIFF: https://github.com/llvm/llvm-project/commit/eb33a7ac765a1e67e2ee51a4f6883986802ac3a0.diff

LOG: [test][sanitizer] Check pthread_create return value

Added: 
    

Modified: 
    compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_loop.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_loop.cpp b/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_loop.cpp
index 0248564ad6278..46bc1b52af447 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_loop.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Posix/create_thread_loop.cpp
@@ -16,8 +16,8 @@ int main(int argc, char **argv) {
   int n = atoi(argv[1]);
   for (int i = 0; i < n; ++i) {
     pthread_t thread;
-    pthread_create(&thread, 0, null_func, NULL);
-    pthread_detach(thread);
+    if (pthread_create(&thread, 0, null_func, NULL) == 0)
+      pthread_detach(thread);
   }
   return 0;
 }


        


More information about the llvm-commits mailing list