From: Daniel Beulshausen Date: Tue, 13 Mar 2001 11:09:37 +0000 (+0000) Subject: fix bug in php_gmtime_r X-Git-Tag: php-4.0.5RC1~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a37a9db454d8910201bd3bbf6d6bef1bdd8cfb66;p=php fix bug in php_gmtime_r --- diff --git a/main/reentrancy.c b/main/reentrancy.c index 00bd0c97f2..027bb8c8a4 100644 --- a/main/reentrancy.c +++ b/main/reentrancy.c @@ -205,11 +205,14 @@ PHPAPI struct tm *php_gmtime_r(const time_t *const timep, struct tm *p_tm) local_lock(GMTIME_R); tmp = gmtime(timep); - memcpy(p_tm, tmp, sizeof(struct tm)); + if (tmp) { + memcpy(p_tm, tmp, sizeof(struct tm)); + tmp = p_tm; + } local_unlock(GMTIME_R); - return p_tm; + return tmp; } #endif