summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Beulshausen <dbeu@php.net>2001-03-13 11:09:37 +0000
committerDaniel Beulshausen <dbeu@php.net>2001-03-13 11:09:37 +0000
commita37a9db454d8910201bd3bbf6d6bef1bdd8cfb66 (patch)
treec9c41a81ca072dd1400219fcce64b579115cc719
parent285ec0ca2c27bc365e4e2bdf18072cb7d3b90445 (diff)
downloadphp-git-a37a9db454d8910201bd3bbf6d6bef1bdd8cfb66.tar.gz
fix bug in php_gmtime_r
-rw-r--r--main/reentrancy.c7
1 files changed, 5 insertions, 2 deletions
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