1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

clvmd: use thread-safe ctime_r when debugging

Use thread friendly version of ctime
TODO:should be probably replaced with strftime()
This commit is contained in:
Zdenek Kabelac 2014-04-09 07:51:36 +02:00
parent 639983b6b7
commit eccc50d861
2 changed files with 3 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.107 -
==================================
Use thread-safe ctime_r() for clvmd debug logging.
Skip adding replies to already finished reply thread.
Use mutex to check number of replies in request_timed_out() in clvmd.
Drop usage of extra reply_mutex for localsock in clvmd.

View File

@ -212,12 +212,13 @@ void debuglog(const char *fmt, ...)
time_t P;
va_list ap;
static int syslog_init = 0;
char buf_ctime[64];
switch (clvmd_get_debug()) {
case DEBUG_STDERR:
va_start(ap,fmt);
time(&P);
fprintf(stderr, "CLVMD[%x]: %.15s ", (int)pthread_self(), ctime(&P)+4 );
fprintf(stderr, "CLVMD[%x]: %.15s ", (int)pthread_self(), ctime_r(&P, buf_ctime) + 4);
vfprintf(stderr, fmt, ap);
va_end(ap);
break;