Fixed unsafe use of localtime

Since localtime is not thread-safe it should not be used in multithreaded
contexts. For this reason all calls to localtime were changed to localtime_r
in code where concurrency issues were possible.

Internal tests were left unchanged because they aren't multithreaded.
This commit is contained in:
Johan Wikman
2015-11-19 15:36:40 +02:00
committed by Markus Makela
parent 84d2c72db2
commit 6164b7f301
9 changed files with 43 additions and 51 deletions

View File

@ -161,7 +161,7 @@ int main(int argc, char* argv[])
ss_dassert(succp);
t = time(NULL);
tm = *(localtime(&t));
localtime_r(&t, &tm);
err = MXS_ERROR("%04d %02d/%02d %02d.%02d.%02d",
tm.tm_year+1900,
tm.tm_mon+1,