diff --git a/newlib/ChangeLog b/newlib/ChangeLog index cc2926b2d..2c7ecc7ea 100644 --- a/newlib/ChangeLog +++ b/newlib/ChangeLog @@ -1,3 +1,8 @@ +2011-06-25 Andreas Becker + + * libc/time/mktime.c (mktime): Lock global timezone info while + accessing it. + 2011-06-14 Philip Munts * libc/time/asctime_r.c (asctime_r): Replace call to sprintf with call diff --git a/newlib/libc/time/mktime.c b/newlib/libc/time/mktime.c index d75d7cc85..acd5d3aa0 100644 --- a/newlib/libc/time/mktime.c +++ b/newlib/libc/time/mktime.c @@ -208,6 +208,8 @@ _DEFUN(mktime, (tim_p), tm_isdst = tim_p->tm_isdst > 0 ? 1 : tim_p->tm_isdst; isdst = tm_isdst; + TZ_LOCK; + if (_daylight) { int y = tim_p->tm_year + YEAR_BASE; @@ -257,6 +259,8 @@ _DEFUN(mktime, (tim_p), else /* otherwise assume std time */ tim += (time_t) tz->__tzrule[0].offset; + TZ_UNLOCK; + /* reset isdst flag to what we have calculated */ tim_p->tm_isdst = isdst;