summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorunknown <cmiller@zippy.cornsilk.net>2007-04-19 17:07:11 -0400
committerunknown <cmiller@zippy.cornsilk.net>2007-04-19 17:07:11 -0400
commit0732ad9a3d2d7c833d638acf395cf364bded90ad (patch)
treec22a5d7239b61efbe580a45608a82175ad7d25f9 /mysys
parent0a3533ff5740d71f70472844570b46b0410ef93c (diff)
downloadmariadb-git-0732ad9a3d2d7c833d638acf395cf364bded90ad.tar.gz
Bug #27964: pthread_key_create doesn't set errno, so don't report \
errno Vasil Dimov (at Oracle) noted that pthread_key_create() does not set errno, so if it fails then we return the wrong error code. Instead, capture the return value, which is the real error value, and instead report that. mysys/my_thr_init.c: pthread functions don't set the global errno, which should be obvious.
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_thr_init.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/mysys/my_thr_init.c b/mysys/my_thr_init.c
index 7a5fdbf8ad6..da465385b3e 100644
--- a/mysys/my_thr_init.c
+++ b/mysys/my_thr_init.c
@@ -79,11 +79,12 @@ static uint get_thread_lib(void);
my_bool my_thread_global_init(void)
{
+ int pth_ret;
thd_lib_detected= get_thread_lib();
- if (pthread_key_create(&THR_KEY_mysys,0))
+ if (pth_ret= pthread_key_create(&THR_KEY_mysys, NULL))
{
- fprintf(stderr,"Can't initialize threads: error %d\n",errno);
+ fprintf(stderr,"Can't initialize threads: pthread error %d\n", pth_ret);
return 1;
}