Bug #27964 pthread_key_create doesn't set errno, so don't report errno
Submitted: 19 Apr 2007 21:05 Modified: 26 Apr 2007 17:36
Reporter: Chad MILLER Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server Severity:S3 (Non-critical)
Version:5.0, 5.1 OS:Any
Assigned to: Chad MILLER CPU Architecture:Any

[19 Apr 2007 21:05] Chad MILLER
Description:
Says Vasil Dimov:

"But pthread_key_create() does not set errno in case of an error but
rather emits the error code as a return value."

How to repeat:
mysys/my_thr_init.c (in 5.1 and 5.0) reads:

84   if (pthread_key_create(&THR_KEY_mysys,0))
85   {
86     fprintf(stderr,"Can't initialize threads: error %d\n",errno);
87     return 1;
88   }

Suggested fix:
obvious
[19 Apr 2007 21:07] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/24957

ChangeSet@1.2439, 2007-04-19 17:07:11-04:00, cmiller@zippy.cornsilk.net +1 -0
  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.
[26 Apr 2007 11:35] Bugs System
Pushed into 5.0.42
[26 Apr 2007 11:36] Bugs System
Pushed into 5.1.18-beta
[26 Apr 2007 17:36] Paul DuBois
No changelog entry needed.