Bug in 0.9.31 with __errno_location in linuxthreads.old

Jean-Denis Boyer jdboyer at media5corp.com
Tue May 11 15:19:29 UTC 2010


Here is a fix that I suggest for 0.9.31.
It is in folder linuxthreads.old, but I don't know if it also applies to the "new" version.

--- a/libpthread/linuxthreads.old/errno.c       2010-04-02 11:34:27.000000000 -0400
+++ b/libpthread/linuxthreads.old/errno.c       2010-05-11 09:44:16.589502638 -0400
@@ -22,6 +22,7 @@
 #include "internals.h"
 #include <stdio.h>
 
+libpthread_hidden_proto(__errno_location)
 int *
 __errno_location (void)
 {
@@ -29,6 +30,7 @@
   return THREAD_GETMEM (self, p_errnop);
 }
 
+libpthread_hidden_proto(__h_errno_location)
 int *
 __h_errno_location (void)
 {

The problem is shown when running the program in attachment.
A thread cannot read the right value of errno, but the main can.
The output of the program is:

thread: Failed to connect (-1 errno=0): Operation now in progress
main: Failed to connect (-1 errno=115): Operation now in progress

Regards,

Jean-Denis Boyer, Eng.
Media5 Corporation - Mediatrix, M5T, Media5Boss
4229 Garlock Street, Sherbrooke (Québec), J1L 2C8, CANADA
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.c
URL: <http://lists.busybox.net/pipermail/uclibc/attachments/20100511/74000638/attachment.diff>


More information about the uClibc mailing list