Previously we were only locking the actual localtime()
call while we should keep the lock until the returned
pointer is no longer being used.
#elif defined(MUTEX_LOCKS_AVAILABLE)
privoxy_mutex_lock(&localtime_mutex);
tm_now = localtime(&now);
- privoxy_mutex_unlock(&localtime_mutex);
#else
tm_now = localtime(&now);
#endif
mins = hrs * 60 + tm_now->tm_min - gmt.tm_min;
length = strftime(buffer, buffer_size, "%d/%b/%Y:%H:%M:%S ", tm_now);
+#if !defined(HAVE_LOCALTIME_R) && defined(MUTEX_LOCKS_AVAILABLE)
+ privoxy_mutex_unlock(&localtime_mutex);
+#endif
if (length > (size_t)0)
{