}
else if (p_ios_base_failure)
{
+ char buf[1024] = {0};
+ char *errno_msg;
+#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
+ int ret = strerror_r(errno, buf, sizeof(buf));
+ errno_msg = ret == 0 ? buf : "<strerror_r failure>";
+#else
+ errno_msg = strerror_r(errno, buf, sizeof(buf));
+#endif
// std::ios_base::failure should be inherited from std::system_error
// for C++11. This workaround applied if it is not true.
LOG().Error() << "Exception: " << p_ios_base_failure->what() << ": "
- << strerror(errno);
+ << errno_msg;
}
else
{