From: Steve Peters Date: Fri, 22 Apr 2005 22:36:03 +0000 (-0500) Subject: Fix for warnings in util.c/Perl_init_tm() X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=ca46b8ee06bde4bff70dee92de161b97200c8d19;p=p5sagit%2Fp5-mst-13.2.git Fix for warnings in util.c/Perl_init_tm() Message-Id: <20050423033603.GA32547@mccoy.peters.homeunix.org> localtime() can return null p4raw-id: //depot/perl@24307 --- diff --git a/util.c b/util.c index 5c1cdea..db56204 100644 --- a/util.c +++ b/util.c @@ -3355,7 +3355,9 @@ Perl_init_tm(pTHX_ struct tm *ptm) /* see mktime, strftime and asctime */ #ifdef HAS_TM_TM_ZONE Time_t now; (void)time(&now); - Copy(localtime(&now), ptm, 1, struct tm); + struct tm* my_tm = localtime(&now); + if (my_tm) + Copy(my_tm, ptm, 1, struct tm); #endif }