svn commit: samba r19403 - in
branches/SAMBA_4_0/source/lib/replace: .
tridge at samba.org
tridge at samba.org
Wed Oct 18 22:33:21 GMT 2006
Author: tridge
Date: 2006-10-18 22:33:20 +0000 (Wed, 18 Oct 2006)
New Revision: 19403
WebSVN: http://websvn.samba.org/cgi-bin/viewcvs.cgi?view=rev&root=samba&rev=19403
Log:
try to fix the crashes in the buildfarm related to timegm
Modified:
branches/SAMBA_4_0/source/lib/replace/timegm.c
Changeset:
Modified: branches/SAMBA_4_0/source/lib/replace/timegm.c
===================================================================
--- branches/SAMBA_4_0/source/lib/replace/timegm.c 2006-10-18 21:45:46 UTC (rev 19402)
+++ branches/SAMBA_4_0/source/lib/replace/timegm.c 2006-10-18 22:33:20 UTC (rev 19403)
@@ -44,13 +44,22 @@
return (y % 4) == 0 && ((y % 100) != 0 || (y % 400) == 0);
}
-time_t timegm(struct tm *tm)
+time_t rep_timegm(struct tm *tm)
{
static const unsigned ndays[2][12] ={
{31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
{31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
time_t res = 0;
unsigned i;
+
+ if (tm->tm_mon > 12 ||
+ tm->tm_mday > 31 ||
+ tm->tm_min > 60 ||
+ tm->tm_sec > 60 ||
+ tm->tm_hour > 24) {
+ /* invalid tm structure */
+ return 0;
+ }
for (i = 70; i < tm->tm_year; ++i)
res += is_leap(i) ? 366 : 365;
More information about the samba-cvs
mailing list