]> granicus.if.org Git - php/commitdiff
fix bug in php_gmtime_r
authorDaniel Beulshausen <dbeu@php.net>
Tue, 13 Mar 2001 11:09:37 +0000 (11:09 +0000)
committerDaniel Beulshausen <dbeu@php.net>
Tue, 13 Mar 2001 11:09:37 +0000 (11:09 +0000)
main/reentrancy.c

index 00bd0c97f2ffdc1c51ad6fc46cfbfc6a7f117532..027bb8c8a4f645c045b85b248d708cdda6eb3323 100644 (file)
@@ -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