[PATCH] D20903: Make system_error::message() thread safe. Fixes PR25598.
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 13 23:10:46 PDT 2016
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
More information about the cfe-commits
mailing list