HPUX 10.X has
    struct tm *gmtime(time_t *t);
    int gmtime_r(time_t *t, struct tm *tm);
while everyone else has both functions returning struct tm *.

The HP man page says that gmtime_r() is changed in the "next release" (11.0?)
to comply with "the new Posix Threads standard".

Here's a patch that should work everywhere.

For the record, this problem would have been caught at compile time instead
of causing a run time core dump if the unnecessary casts weren't there.

Index: crypto/asn1/a_gentm.c
===================================================================
RCS file: /CVS/openssl/crypto/asn1/a_gentm.c,v
retrieving revision 1.4
diff -u -r1.4 a_gentm.c
--- a_gentm.c   1999/04/26 16:40:17     1.4
+++ a_gentm.c   1999/05/01 04:22:23
@@ -183,9 +183,10 @@
                return(NULL);
 
 #if defined(THREADS) && !defined(WIN32)
-       ts=(struct tm *)gmtime_r(&t,&data);
+       gmtime_r(&t,&data);
+       ts=&data;
 #else
-       ts=(struct tm *)gmtime(&t);
+       ts=gmtime(&t);
 #endif
        p=(char *)s->data;
        if ((p == NULL) || (s->length < 16))
Index: crypto/asn1/a_time.c
===================================================================
RCS file: /CVS/openssl/crypto/asn1/a_time.c,v
retrieving revision 1.3
diff -u -r1.3 a_time.c
--- a_time.c    1999/04/23 22:08:08     1.3
+++ a_time.c    1999/05/01 04:21:06
@@ -97,9 +97,10 @@
 #endif
 
 #if defined(THREADS) && !defined(WIN32)
-       ts=(struct tm *)gmtime_r(&t,&data);
+       gmtime_r(&t,&data);
+       ts=&data;
 #else
-       ts=(struct tm *)gmtime(&t);
+       ts=gmtime(&t);
 #endif
        if((ts->tm_year >= 1950) && (ts->tm_year < 2050))
                                        return ASN1_UTCTIME_set(s, t);
Index: crypto/asn1/a_utctm.c
===================================================================
RCS file: /CVS/openssl/crypto/asn1/a_utctm.c,v
retrieving revision 1.4
diff -u -r1.4 a_utctm.c
--- a_utctm.c   1999/04/26 16:40:18     1.4
+++ a_utctm.c   1999/05/01 04:20:35
@@ -177,9 +177,10 @@
                return(NULL);
 
 #if defined(THREADS) && !defined(WIN32)
-       ts=(struct tm *)gmtime_r(&t,&data);
+       gmtime_r(&t,&data);
+       ts=&data;
 #else
-       ts=(struct tm *)gmtime(&t);
+       ts=gmtime(&t);
 #endif
        p=(char *)s->data;
        if ((p == NULL) || (s->length < 14))
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to