strerror_r not according to standard ?

Eric Blake
Tue May 25 07:35:00 GMT 2010

On 05/24/2010 10:04 AM, Vinu Rajashekhar wrote:
> I have a doubt regarding the newlib implementation of strerror_r.

strerror_r is a can of worms, thanks to the conflict between GNU and
POSIX definitions.

> The function doesn't set ERANGE if the buflen given is insufficient
> to store the whole description of the errno. Similarly, it doesn't set
> EINVAL if errno is not a  valid error number.

Patches to fix that behavior to be more like glibc would be welcome.

> Another thing is that it, in the linux manpages it says that strerror_r (the GNU
> extension) always returns a null-terminated string, which is not the case
> for the newlib strerror_r.

Again, patches welcome.  But patches to change things to match the POSIX
signature would have to be conditionalized, because some newlib clients
(like cygwin) still want to keep the glibc signature.

Eric Blake    +1-801-349-2682
Libvirt virtualization library

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Newlib mailing list