bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: new files imported without new modules added


From: Eric Blake
Subject: Re: new files imported without new modules added
Date: Tue, 24 May 2011 15:46:13 -0600
User-agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.17) Gecko/20110428 Fedora/3.1.10-1.fc14 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.10

On 05/24/2011 03:39 PM, Bruno Haible wrote:
>   1) In code that ends up in lisp.run (e.g. errunix.d). This executable has
>      the option to use multiple threads. Therefore strerror_r should be
>      used instead of strerror(), because - as Eric explained - when you
>      call strerror(EACCES) in one thread and strerror(ENOENT) in another
>      thread at nearly the same time, by the time you retrieve the error 
> message
>      in the first thread, it might read "Permissionle or directory".
>      YES, even for fixed error messages, strerror() uses a static buffer
>      in the majority of OSes (at least on NetBSD, HP-UX, native Win32, 
> Cygwin).

Not cygwin (it uses a thread-local buffer for "Unknown error", and
direct string pointers for known errors), but I can indeed confirm that
FreeBSD 8.2 returns the same pointer for multiple strerror() results,
and if that pointer is not thread-local, you have problems in a
multi-threaded app.

-- 
Eric Blake   address@hidden    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]