Add support for XSI-compliant strerror_r
This commit is contained in:
parent
8a8f7b065c
commit
b30b654871
@ -83,7 +83,14 @@ std::string logger::format(const std::string& fmt, ...)
|
|||||||
std::string logger::err()
|
std::string logger::err()
|
||||||
{
|
{
|
||||||
char buf[2048];
|
char buf[2048];
|
||||||
|
|
||||||
|
#if (_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE
|
||||||
|
if (strerror_r(errno, buf, sizeof(buf))
|
||||||
|
return "Unknown error";
|
||||||
|
return buf;
|
||||||
|
#else
|
||||||
return strerror_r(errno, buf, sizeof(buf));
|
return strerror_r(errno, buf, sizeof(buf));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
logger logger::error()
|
logger logger::error()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user