summaryrefslogtreecommitdiff
path: root/library/platform_util.c
diff options
context:
space:
mode:
authorHanno Becker <hanno.becker@arm.com>2018-09-06 09:06:33 +0100
committerHanno Becker <hanno.becker@arm.com>2018-09-06 09:06:33 +0100
commit6f70581c4aa8753969caa3f79db155c74228bfe5 (patch)
tree8a596aad231af1da148eb5bcab5c6b55915f403f /library/platform_util.c
parentc52ef407bad144109ac52cc25f1519cdd2f39520 (diff)
Correct POSIX version check to determine presence of gmtime_r()
Recent versions of POSIX move gmtime_r to the base.
Diffstat (limited to 'library/platform_util.c')
-rw-r--r--library/platform_util.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/library/platform_util.c b/library/platform_util.c
index ddb56ed0..7e82293e 100644
--- a/library/platform_util.c
+++ b/library/platform_util.c
@@ -81,7 +81,10 @@ void mbedtls_platform_zeroize( void *buf, size_t len )
defined(__unix) || defined(__unix__) || (defined(__APPLE__) && \
defined(__MACH__)))
#include <unistd.h>
-#if !defined(_POSIX_VERSION) || _POSIX_C_SOURCE > _POSIX_THREAD_SAFE_FUNCTIONS
+
+#if !( ( defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L ) || \
+ ( defined(_POSIX_THREAD_SAFE_FUNCTIONS ) && \
+ _POSIX_THREAD_SAFE_FUNCTIONS >= 20112L ) )
/*
* This is a convenience shorthand macro to avoid checking the long
* preprocessor conditions above. Ideally, we could expose this macro in
@@ -90,7 +93,9 @@ void mbedtls_platform_zeroize( void *buf, size_t len )
* we keep it private by only defining it in this file
*/
#define PLATFORM_UTIL_USE_GMTIME
-#endif /* !_POSIX_VERSION || _POSIX_C_SOURCE > _POSIX_THREAD_SAFE_FUNCTIONS */
+#endif /* !( ( defined(_POSIX_VERSION) && _POSIX_VERSION >= 200809L ) || \
+ ( defined(_POSIX_THREAD_SAFE_FUNCTIONS ) && \
+ _POSIX_THREAD_SAFE_FUNCTIONS >= 20112L ) ) */
#endif /* !_WIN32 && (unix || __unix || __unix__ ||
* (__APPLE__ && __MACH__)) */