From 186768abd4e485965b4129b5dd00f5efec0667ae Mon Sep 17 00:00:00 2001 From: qmuntal Date: Wed, 4 Sep 2024 05:26:19 +0000 Subject: [PATCH] use valid address in pthread_setspecific to silence warnings --- thread_setup_unix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/thread_setup_unix.c b/thread_setup_unix.c index 53ea9d03..cf323439 100644 --- a/thread_setup_unix.c +++ b/thread_setup_unix.c @@ -9,6 +9,8 @@ static pthread_mutex_t *mutex_buf = NULL; static pthread_key_t destructor_key; +static char dummy; + /* Used by unit tests. */ volatile unsigned int go_openssl_threads_cleaned_up = 0; @@ -29,7 +31,7 @@ static void thread_id(GO_CRYPTO_THREADID_PTR tid) // least once on any thread with associated error state. The thread-local // variable needs to be set to a non-NULL value so that the destructor will // be called when the thread exits. The actual value does not matter. - (void) pthread_setspecific(destructor_key, (void*)1); + (void) pthread_setspecific(destructor_key, &dummy); } static void cleanup_thread_state(void *ignored)