From 5c9fd7c96fe5f2d363fe0f7d60922cb97632b884 Mon Sep 17 00:00:00 2001 From: David Hill Date: Tue, 8 Jan 2013 09:30:56 +0100 Subject: bugfix: timeval2syslogTime cause problems on some platforms ...due to invalid assumption on structure data types. closes: http://bugzilla.adiscon.com/show_bug.cgi?id=394 --- ChangeLog | 4 ++++ runtime/datetime.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0d088727..67a458ae 100644 --- a/ChangeLog +++ b/ChangeLog @@ -13,6 +13,10 @@ Version 7.2.5 [v7-stable] 2013-01-?? - bugfix: very large memory consumption (and probably out of memory) when FromPos was specified in template, but ToPos not. Thanks to Radu Gheorghe for alerting us of this bug. +- bugfix: timeval2syslogTime cause problems on some platforms + due to invalid assumption on structure data types. + closes: http://bugzilla.adiscon.com/show_bug.cgi?id=394 + Thanks to David Hill for the patch. ---------------------------------------------------------------------------- Version 7.2.4 [v7-stable] 2012-12-07 - enhance: permit RFC3339 timestamp in local log socket messages diff --git a/runtime/datetime.c b/runtime/datetime.c index c03abab9..7d974471 100644 --- a/runtime/datetime.c +++ b/runtime/datetime.c @@ -61,8 +61,10 @@ timeval2syslogTime(struct timeval *tp, struct syslogTime *t) struct tm *tm; struct tm tmBuf; long lBias; + time_t secs; - tm = localtime_r((time_t*) &(tp->tv_sec), &tmBuf); + secs = tp->tv_sec; + tm = localtime_r(&secs, &tmBuf); t->year = tm->tm_year + 1900; t->month = tm->tm_mon + 1; -- cgit v1.2.3