tech-userlevel archive

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

Re: Adding %m conversion to the printf(3) family



On Saturday 24 October 2015 01:03:09 Joerg Sonnenberger wrote:
> On Fri, Oct 23, 2015 at 10:33:52PM +0100, Roy Marples wrote:
> > 2) The alternative of using %s and strerror(3) is problematic in portable
> > applications for these reasons
> > 
> >   *  strerror(3) isn't guaranteed to be threadsafe (it is on NetBSD)
> 
> Is there any platform where strerror is *not* threadsafe given:
> (1) No current locale changes.
> (2) system generated (aka non-arbitrary) errno value.
> 
> All implementations I know fallback to the local buffer only for the
> second case to include the formated errno value.

Both FreeBSD and OpenBSD use a local buffer and just pass that to strerror_r.


Home | Main Index | Thread Index | Old Index