summaryrefslogtreecommitdiffhomepage
path: root/compat/strerror.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-22 15:40:46 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-22 15:41:10 +0100
commit75781b37b19b4b8cb247a45683fc28b5080e0fdb (patch)
treebad7c6144aeca4bc3ad023142253739c0f19de31 /compat/strerror.cpp
parentb3b540cb8feea18e54a1160b88e729cc9e55df7b (diff)
try fix CI
Diffstat (limited to 'compat/strerror.cpp')
-rw-r--r--compat/strerror.cpp22
1 files changed, 10 insertions, 12 deletions
diff --git a/compat/strerror.cpp b/compat/strerror.cpp
index 67b87e2f..0afb5f7d 100644
--- a/compat/strerror.cpp
+++ b/compat/strerror.cpp
@@ -7,18 +7,16 @@ namespace floormat {
StringView get_error_string(ArrayView<char> buf)
{
#ifndef _WIN32
- if constexpr(std::is_same_v<char*, std::decay_t<decltype(::strerror_r(errno, buf.data(), buf.size()))>>)
- {
- const char* str { ::strerror_r(errno, buf.data(), buf.size()) };
- if (str)
- return str;
- }
- else
- {
- const int status { ::strerror_r(errno, buf.data(), buf.size()) };
- if (status == 0)
- return buf;
- }
+#if defined __GLIBC__ && !((_POSIX_C_SOURCE >= 200112L || _XOPEN_SOURCE >= 600) && ! _GNU_SOURCE)
+ char* str = ::strerror_r(errno, buf.data(), buf.size());
+ if (str)
+ return str;
+#else
+ int status { ::strerror_r(errno, buf.data(), buf.size()) };
+ if (status == 0)
+ return buf;
+#endif
+
#else
::strerror_s(buf.data(), buf.size(), errno);
if (buf[0])