EricWF added a comment.

In http://reviews.llvm.org/D20903#457252, @erik65536 wrote:

> > The POSIX version of strerror_r() returns 0 on success, and any other value 
> > indicates an error (Reference 
> > <http://pubs.opengroup.org/onlinepubs/9699919799/functions/strerror.html>).
>
>
> I should have been more explicit when I wrote this recommendation. Checking 
> if `strerror_r` returns -1 is not portable. For example, OSX and FreeBSD 
> return an error code from `strerror_r` without setting `errno`. The POSIX 
> version should check for success by checking to see if `strerror_r` returns 
> 0. If the function fails and the return value is not -1, assume that the 
> return value is an error code.


Urg IDK how I missed that in the docs. Thanks for pointing this out.

I fixed it in r272640. I'll follow up with some tests for the FreeBSD and OS X 
implementations.


http://reviews.llvm.org/D20903



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to