[Piglit] [PATCH] glx-multithread-clearbuffer: Check pthread_join return value.
Vinson Lee
vlee at freedesktop.org
Tue Jul 25 00:42:45 UTC 2017
Fix Coverity unchecked return value defect.
CID: 1415101
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
tests/glx/glx-multithread-clearbuffer.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/tests/glx/glx-multithread-clearbuffer.c b/tests/glx/glx-multithread-clearbuffer.c
index 577fde842435..da301089f2a6 100644
--- a/tests/glx/glx-multithread-clearbuffer.c
+++ b/tests/glx/glx-multithread-clearbuffer.c
@@ -82,6 +82,7 @@ main(int argc, char **argv)
{
/* Need at least 16 contexts to congest the thread queue. */
pthread_t thread[16];
+ bool pass = true;
XInitThreads();
@@ -90,11 +91,15 @@ main(int argc, char **argv)
for (int i = 0; i < ARRAY_SIZE(thread); i++)
pthread_create(&thread[i], NULL, thread_func, NULL);
- for (int i = 0; i < ARRAY_SIZE(thread); i++)
- pthread_join(thread[i], NULL);
+ for (int i = 0; i < ARRAY_SIZE(thread); i++) {
+ int err = pthread_join(thread[i], NULL);
+
+ if (err)
+ pass = false;
+ }
pthread_mutex_destroy(&mutex);
- piglit_report_result(PIGLIT_PASS);
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
return 0;
}
--
2.11.0
More information about the Piglit
mailing list