From f120cc103581d43ab08970222e6e836434b8d765 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Sat, 13 Jun 2009 01:19:33 -0400 Subject: [PATCH] Fix perthreadlock test segmentation fault when 0 readers due to incorrect mutex array indexing (int vs long types). Signed-off-by: Mathieu Desnoyers --- test_perthreadlock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test_perthreadlock.c b/test_perthreadlock.c index 7d72231..89cce65 100644 --- a/test_perthreadlock.c +++ b/test_perthreadlock.c @@ -185,7 +185,7 @@ void *thr_writer(void *data) } test_array.a = 0; test_array.a = 8; - for (tidx = nr_readers - 1; tidx >= 0; tidx--) { + for (tidx = (long)nr_readers - 1; tidx >= 0; tidx--) { pthread_mutex_unlock(&per_thread_lock[tidx].lock); } nr_writes++; -- 2.34.1