On 07/24/2017 06:42 PM, Vinson Lee wrote:
Fix Coverity unchecked return value defect.
CID: 1415101
Signed-off-by: Vinson Lee <v...@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;
Normally, I'd probably write it as:
if (pthread_join(thread[i], NULL) != 0)
pass = false;
but if one were debugging with gdb, the err var would be helpful.
+ }
pthread_mutex_destroy(&mutex);
- piglit_report_result(PIGLIT_PASS);
+ piglit_report_result(pass ? PIGLIT_PASS : PIGLIT_FAIL);
return 0;
}
Reviewed-by: Brian Paul <bri...@vmware.com>
_______________________________________________
Piglit mailing list
Piglit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/piglit