o_time.c: use gmtime_s with MSVC
authorMiroslav Suk <miroslav.suk@eset.cz>
Thu, 22 Mar 2018 08:20:43 +0000 (09:20 +0100)
committerAndy Polyakov <appro@openssl.org>
Wed, 28 Mar 2018 20:46:31 +0000 (22:46 +0200)
Reviewed-by: Andy Polyakov <appro@openssl.org>
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/5719)

crypto/o_time.c

index 61927439eaf5184177d5f971ed5b6ea7a836ce8e..a763b2ce202d59e88dede7f46a71d936122f76b8 100755 (executable)
@@ -109,6 +109,10 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
     if (gmtime_r(timer, result) == NULL)
         return NULL;
     ts = result;
+#elif defined (OPENSSL_SYS_WINDOWS) && defined(_MSC_VER) && _MSC_VER >= 1400
+    if (gmtime_s(result, timer))
+        return NULL;
+    ts = result;
 #elif !defined(OPENSSL_SYS_VMS) || defined(VMS_GMTIME_OK)
     ts = gmtime(timer);
     if (ts == NULL)