From 9c47f3e057e990e77ece2a102729b2400a487c9f Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 9 Jul 2014 09:45:18 -0700 Subject: [PATCH] Fix MinGW issues, take 2. --- format.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/format.cc b/format.cc index 090b4bcc..3226b17d 100644 --- a/format.cc +++ b/format.cc @@ -301,7 +301,12 @@ int fmt::internal::StrError( if (message == buffer && strlen(buffer) == buffer_size - 1) result = ERANGE; buffer = message; -#elif defined(_WIN32) && !defined(__MINGW32__) +#elif __MINGW32__ + errno = 0; + (void)buffer_size; + buffer = strerror(error_code); + result = errno; +#elif _WIN32 result = strerror_s(buffer, buffer_size, error_code); // If the buffer is full then the message is probably truncated. if (result == 0 && std::strlen(buffer) == buffer_size - 1)