fix perror POSIX compliance

Eric Blake
Wed May 25 19:48:00 GMT 2011

On 05/24/2011 04:08 AM, Corinna Vinschen wrote:
> On May 23 17:16, Eric Blake wrote:
>> 	* libc/string/strerror.c (strerror): Split body into...
>> 	(_strerror_r): reentrant function.
>> 	* libc/string/u_strerr.c (_user_strerror): Update signature.
>> 	* libc/include/stdio.h (_strerror_r): New prototype.
>> 	* libc/posix/collate.c (__collate_err): Adjust callers.
>> 	* libc/stdio/perror.c (_perror_r): Likewise.
>> 	* libc/string/strerror_r.c (strerror_r): Likewise.
>> 	* libc/string/xpg_strerror_r.c (__xpg_strerror_r): Likewise.
> Looks good to me.  It build and runs for me on Cygwin.  You did test it,
> also with the newlib strerror and strerror_r functions, right?  If so,
> please apply.

I've (finally) completed runtime testing of both the newlib patch in
isolation (by #if 0'ing the cygwin replacements to pull in the
newlib implementation) and the cygwin patch.

Testing turned up only one issue on the newlib side (cygwin is immune) -
POSIX requires strerror(0) to return a message indicating success,
rather than treating it the same as all other EINVAL inputs.  Patch
coming up shortly, now that this one is pushed.

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