This glues the GMP wrapper ENGINE into OpenSSL if it is being built (ie. if
[openssl.git] / crypto / o_time.c
index 136ea567b7819d502996df3812a1a3985f3dc6fb..ca5f3ea48e0a259e39e6575d65a33a21311db244 100644 (file)
@@ -1,5 +1,5 @@
 /* crypto/o_time.c -*- mode:C; c-file-style: "eay" -*- */
-/* Written by Richard Levitte (levitte@stacken.kth.se) for the OpenSSL
+/* Written by Richard Levitte (richard@levitte.org) for the OpenSSL
  * project 2001.
  */
 /* ====================================================================
@@ -57,6 +57,7 @@
  */
 
 #include <openssl/e_os2.h>
+#include <string.h>
 #include "o_time.h"
 
 #ifdef OPENSSL_SYS_VMS
@@ -72,14 +73,15 @@ struct tm *OPENSSL_gmtime(const time_t *timer, struct tm *result)
        {
        struct tm *ts = NULL;
 
-#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(__CYGWIN32__) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r))
+#if defined(OPENSSL_THREADS) && !defined(OPENSSL_SYS_WIN32) && !defined(OPENSSL_SYS_OS2) && !defined(__CYGWIN32__) && (!defined(OPENSSL_SYS_VMS) || defined(gmtime_r)) && !defined(OPENSSL_SYS_MACOSX)
        /* should return &data, but doesn't on some systems,
           so we don't even look at the return value */
        gmtime_r(timer,result);
        ts = result;
 #elif !defined(OPENSSL_SYS_VMS)
        ts = gmtime(timer);
-       memcpy(result, ts, sizeof(struct tm));
+       if (ts != NULL)
+               memcpy(result, ts, sizeof(struct tm));
        ts = result;
 #endif
 #ifdef OPENSSL_SYS_VMS