From df24b3a070cc50e521b21fc2877e5b3985535a73 Mon Sep 17 00:00:00 2001 From: David Oberhollenzer Date: Thu, 19 Mar 2020 01:58:38 +0100 Subject: Fix pthread_join check for valid thread handles On Linux, checking for > 0 worked because pthread_t is internally an integer type. On other platforms (*caugh* Mac OS X *caugh*), it is typedefed to an opaque pointer, causing a warning if used in an integer relational comparison. The intended use is to allow the generic cleanup function to be used in the error path of the block processor creation function, while preventing pthread_join being called on threads that haven't been created at all. Since they are calloc'ed to 0, testing for non-zero values should suffice in both cases. Signed-off-by: David Oberhollenzer --- lib/sqfs/block_processor/winpthread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sqfs/block_processor/winpthread.c b/lib/sqfs/block_processor/winpthread.c index 1aa77e7..80cbde9 100644 --- a/lib/sqfs/block_processor/winpthread.c +++ b/lib/sqfs/block_processor/winpthread.c @@ -34,7 +34,7 @@ # define UNLOCK(mtx) pthread_mutex_unlock(mtx) # define AWAIT(cond, mtx) pthread_cond_wait(cond, mtx) # define SIGNAL_ALL(cond) pthread_cond_broadcast(cond) -# define THREAD_JOIN(t) if (t > 0) { pthread_join(t, NULL); } +# define THREAD_JOIN(t) if (t != (pthread_t)0) { pthread_join(t, NULL); } # define MUTEX_DESTROY(mtx) pthread_mutex_destroy(mtx) # define CONDITION_DESTROY(cond) pthread_cond_destroy(cond) # define THREAD_EXIT_SUCCESS NULL -- cgit v1.2.3