[waffle] [PATCH 1/2] core/tests: correctly store the threads exit codes
Emil Velikov
emil.l.velikov at gmail.com
Wed Aug 20 04:54:24 PDT 2014
The exit codes are defined as ints, while we were using an bool array.
This resulted in stack corruption due to the difference of the size in
the two types.
Huge thanks to Jose for spotting this one.
Spotted-by: Jose Fonseca <jfonseca at vmware.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
This is a replacement for [PATCH 4/4] wgl: attempt to fix the final test
which was attempting to "fix" the wrong thing.
-Emil
src/waffle/core/wcore_error_unittest.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/waffle/core/wcore_error_unittest.c b/src/waffle/core/wcore_error_unittest.c
index 5176031..b63df3b 100644
--- a/src/waffle/core/wcore_error_unittest.c
+++ b/src/waffle/core/wcore_error_unittest.c
@@ -190,7 +190,7 @@ test_wcore_error_thread_local(void **state) {
thrd_t threads[NUM_THREADS];
struct thread_arg thread_args[NUM_THREADS];
- bool exit_codes[NUM_THREADS];
+ int exit_codes[NUM_THREADS];
mtx_init(&mutex, mtx_plain);
cnd_init(&cond);
@@ -217,7 +217,7 @@ test_wcore_error_thread_local(void **state) {
}
for (int i = 0; i < NUM_THREADS; ++i) {
- thrd_join(threads[i], (int *) &exit_codes[i]);
+ thrd_join(threads[i], &exit_codes[i]);
assert_true(exit_codes[i]);
}
--
2.0.2
More information about the waffle
mailing list