From 5f8c7655a7611b96fc5d2fbc099f1bb927f0da7f Mon Sep 17 00:00:00 2001 From: Xu Jun <693788454@qq.com> Date: Sat, 5 Feb 2022 22:45:59 +0800 Subject: [PATCH] Fix pthread_getspecific return value (#999) Fix pthread_getspecific return value as mentioned in #995 --- core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c b/core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c index 90b603942..7c0322dbe 100644 --- a/core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c +++ b/core/iwasm/libraries/lib-pthread/lib_pthread_wrapper.c @@ -1011,7 +1011,7 @@ pthread_setspecific_wrapper(wasm_exec_env_t exec_env, int32 key, key_values = key_value_list_lookup_or_create(exec_env, info, key); if (!key_values) { os_mutex_unlock(&info->key_data_list_lock); - return 0; + return -1; } key_values[key] = value_offset; @@ -1028,7 +1028,7 @@ pthread_getspecific_wrapper(wasm_exec_env_t exec_env, int32 key) int32 ret, *key_values; if (!info) - return -1; + return 0; os_mutex_lock(&info->key_data_list_lock);