Merge remote-tracking branch 'upstream-public/pr/1295' into mbedtls-2.1-proposed
diff --git a/ChangeLog b/ChangeLog
index abf96ac..ef91aac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -32,6 +32,9 @@
is not enabled. Set MBEDTLS_SSL_MIN_MAJOR_VERSION
and MBEDTLS_SSL_MIN_MINOR_VERSION instead of
MBEDTLS_SSL_MAJOR_VERSION_3 and MBEDTLS_SSL_MINOR_VERSION_1. #664
+ * Fix compilation error on Mingw32 when _TRUNCATE is defined. Use _TRUNCATE
+ only if __MINGW32__ not defined. Fix suggested by Thomas Glanzmann and
+ Nick Wilson on issue #355
Changes
* Clarified the documentation of mbedtls_ssl_setup.
diff --git a/library/debug.c b/library/debug.c
index 4752ab1..afa21cb 100644
--- a/library/debug.c
+++ b/library/debug.c
@@ -90,7 +90,7 @@
va_start( argp, format );
#if defined(_WIN32)
-#if defined(_TRUNCATE)
+#if defined(_TRUNCATE) && !defined(__MINGW32__)
ret = _vsnprintf_s( str, DEBUG_BUF_SIZE, _TRUNCATE, format, argp );
#else
ret = _vsnprintf( str, DEBUG_BUF_SIZE, format, argp );
diff --git a/library/platform.c b/library/platform.c
index d634c62..e90dc3c 100644
--- a/library/platform.c
+++ b/library/platform.c
@@ -74,7 +74,7 @@
return( -1 );
va_start( argp, fmt );
-#if defined(_TRUNCATE)
+#if defined(_TRUNCATE) && !defined(__MINGW32__)
ret = _vsnprintf_s( s, n, _TRUNCATE, fmt, argp );
#else
ret = _vsnprintf( s, n, fmt, argp );