summaryrefslogtreecommitdiffstats
path: root/src/shared/log.c
diff options
context:
space:
mode:
authorSimon Rettberg2016-01-11 12:09:23 +0100
committerSimon Rettberg2016-01-11 12:09:23 +0100
commitd9c2a6cf943ca08f31f61a3fada940f77e3a03d3 (patch)
tree31f627a3d52ff838b046f41516a0fbef0b58b9ee /src/shared/log.c
parent[KERNEL/CLIENT] Several minor tweaks and changes (diff)
downloaddnbd3-d9c2a6cf943ca08f31f61a3fada940f77e3a03d3.tar.gz
dnbd3-d9c2a6cf943ca08f31f61a3fada940f77e3a03d3.tar.xz
dnbd3-d9c2a6cf943ca08f31f61a3fada940f77e3a03d3.zip
[SERVER] Fix a lot of (mostly harmless) data races
Diffstat (limited to 'src/shared/log.c')
-rw-r--r--src/shared/log.c6
1 files changed, 3 insertions, 3 deletions
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 );