erik65536 added a comment.

> 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.


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