[uClibc] strerror not thread safe (not re enterant)

Erik Andersen andersen at codepoet.org
Sat Jan 8 21:23:01 UTC 2005


On Thu Jan 06, 2005 at 06:05:12PM -0800, Philip Rakity wrote:
> 
> strerror is not thread safe since it uses a static buffer.

Per SuSv3:

    The strerror() function need not be reentrant. A function
    that is not required to be reentrant is not required to be
    thread-safe.

http://www.opengroup.org/onlinepubs/009695399/functions/strerror.html

If you want thread safety, use strerror_r().  Note that there is
a discrepancey between glibc's strerror_r() and the SuSv3
specification (i.e. glibc gets it wrong).  uClibc uses the SuSv3
version unless your code has defined _GNU_SOURCE.

 -Erik

--
Erik B. Andersen             http://codepoet-consulting.com/
--This message was written using 73% post-consumer electrons--



More information about the uClibc mailing list