From d9c2a6cf943ca08f31f61a3fada940f77e3a03d3 Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 11 Jan 2016 12:09:23 +0100 Subject: [SERVER] Fix a lot of (mostly harmless) data races --- src/shared/log.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/shared/log.c') diff --git a/src/shared/log.c b/src/shared/log.c index 6d77dc5..da27392 100644 --- a/src/shared/log.c +++ b/src/shared/log.c @@ -82,12 +82,12 @@ void logadd(const logmask_t mask, const char *fmt, ...) va_list ap; int ret; time_t rawtime; - struct tm *timeinfo; + struct tm timeinfo; char buffer[LINE_LEN]; time( &rawtime ); - timeinfo = localtime( &rawtime ); - size_t offset = strftime( buffer, LINE_LEN, "[%d.%m. %H:%M:%S] ", timeinfo ); + localtime_r( &rawtime, &timeinfo ); + size_t offset = strftime( buffer, LINE_LEN, "[%d.%m. %H:%M:%S] ", &timeinfo ); offset += writeLevel( buffer + offset, mask ); va_start( ap, fmt ); ret = vsnprintf( buffer + offset, LINE_LEN - offset, fmt, ap ); -- cgit v1.2.3-55-g7522