From 637182b8f4f43eeed7c83040173aa6d47ea7997f Mon Sep 17 00:00:00 2001 From: Pierangelo Masarati Date: Wed, 19 Aug 2009 00:12:39 +0000 Subject: [PATCH] fix previous commit --- libraries/libldap/util-int.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/libraries/libldap/util-int.c b/libraries/libldap/util-int.c index 062c892fba..d07ce1865e 100644 --- a/libraries/libldap/util-int.c +++ b/libraries/libldap/util-int.c @@ -147,7 +147,10 @@ ldap_pvt_gmtime( const time_t *timep, struct tm *result ) # endif /* LDAP_R_COMPILE */ tm_ptr = gmtime( timep ); - if ( tm_ptr != NULL ) { + if ( tm_ptr == NULL ) { + result = NULL; + + } else { *result = *tm_ptr; } @@ -155,7 +158,7 @@ ldap_pvt_gmtime( const time_t *timep, struct tm *result ) ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex ); # endif /* LDAP_R_COMPILE */ - return tm_ptr; + return result; } #endif /* !USE_GMTIME_R */ @@ -170,7 +173,10 @@ ldap_pvt_localtime( const time_t *timep, struct tm *result ) # endif /* LDAP_R_COMPILE */ tm_ptr = localtime( timep ); - if ( tm_ptr != NULL ) { + if ( tm_ptr == NULL ) { + result = NULL; + + } else { *result = *tm_ptr; } @@ -178,7 +184,7 @@ ldap_pvt_localtime( const time_t *timep, struct tm *result ) ldap_pvt_thread_mutex_unlock( &ldap_int_gmtime_mutex ); # endif /* LDAP_R_COMPILE */ - return tm_ptr; + return result; } #endif /* !USE_LOCALTIME_R */ -- 2.39.5