[PATCH] strerror_r: guarantee unchanged errno

2011-05-19 Thread Eric Blake
POSIX guarantees that strerror doesn't change errno on success, and since we implement strerror by using strerror_r, it makes sense to make the same guarantee for strerror_r (rather, going one step further to say that sterror_r does not corrupt errno even on failure, since it returns an error

Re: [PATCH] strerror_r: guarantee unchanged errno

2011-05-19 Thread Bruno Haible
Hi Eric, * lib/strerror_r.c (strerror_r): Guarantee unchanged errno. ... preserving errno is important when replacing sterror_r on platforms that return -1. Makes sense, yes. --- a/lib/strerror.c +++ b/lib/strerror.c @@ -50,6 +50,7 @@ strerror (int n) static char const fmt[] =