$NetBSD: patch-ae,v 1.2 2011/07/13 20:01:40 drochner Exp $ --- src/common.c.orig 2011-06-22 13:25:40.000000000 +0000 +++ src/common.c @@ -273,9 +273,9 @@ static const gchar *dayofweek[] = { "Sun static const gchar *months[] = {"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"}; gchar *createRFC822Date(const time_t *time) { - struct tm *tm; + struct tm *tm, tmbuf; - tm = gmtime(time); /* No need to free because it is statically allocated */ + tm = gmtime_r(time, &tmbuf); /* No need to free because it is statically allocated */ return g_strdup_printf("%s, %2d %s %4d %02d:%02d:%02d GMT", dayofweek[tm->tm_wday], tm->tm_mday, months[tm->tm_mon], 1900 + tm->tm_year, tm->tm_hour, tm->tm_min, tm->tm_sec); } @@ -374,7 +374,7 @@ static time_t common_parse_rfc822_tz(cha /* converts a RFC822 time string to a time_t value */ time_t parseRFC822Date(gchar *date) { - struct tm tm; + struct tm tm, t2buf; time_t t, t2; char *oldlocale; char *pos; @@ -422,7 +422,7 @@ time_t parseRFC822Date(gchar *date) { correction. (Usually, there is no daylight savings time since the input is GMT.) */ t = t - common_parse_rfc822_tz(pos); - t2 = mktime(gmtime(&t)); + t2 = mktime(gmtime_r(&t, &t2buf)); t = t - (t2 - t); return t; } else {