Commit bdeffc3f authored by Victor Zverovich's avatar Victor Zverovich

Fix build on Android NDK

where XSI-compliant version of strerror_r is used violating the docs at
http://linux.die.net/man/3/strerror_r
parent b4eef591
......@@ -134,7 +134,13 @@ int safe_strerror(
int error_code, char *&buffer, std::size_t buffer_size) FMT_NOEXCEPT(true) {
assert(buffer != 0 && buffer_size != 0);
int result = 0;
#ifdef _GNU_SOURCE
#if ((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && !_GNU_SOURCE) || __ANDROID__
// XSI-compliant version of strerror_r.
result = strerror_r(error_code, buffer, buffer_size);
if (result != 0)
result = errno;
#elif _GNU_SOURCE
// GNU-specific version of strerror_r.
char *message = strerror_r(error_code, buffer, buffer_size);
// If the buffer is full then the message is probably truncated.
if (message == buffer && strlen(buffer) == buffer_size - 1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment