diff options
author | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-03-31 03:19:34 +0000 |
---|---|---|
committer | markster <markster@f38db490-d61c-443f-a65b-d21fe96a405b> | 2003-03-31 03:19:34 +0000 |
commit | d53be73ebe9f97b545594f1c2db16926aaddf524 (patch) | |
tree | 06b9e7ecdef28acd64e8fe5614020f23b743687f /logger.c | |
parent | e0c466aa42beff5788490914ece124091e8a7da7 (diff) |
Eliminate localtime calls, various cleanups
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@723 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'logger.c')
-rwxr-xr-x | logger.c | 12 |
1 files changed, 6 insertions, 6 deletions
@@ -228,7 +228,7 @@ extern void ast_log(int level, const char *file, int line, const char *function, char tmp4[80]; char linestr[80]; time_t t; - struct tm *tm; + struct tm tm; struct logfile *f; va_list ap; @@ -238,10 +238,10 @@ extern void ast_log(int level, const char *file, int line, const char *function, ast_pthread_mutex_lock(&loglock); if (level == 1 /* Event */) { time(&t); - tm = localtime(&t); - if (tm) { + localtime_r(&t,&tm); + if (&tm) { /* Log events into the event log file, with a different format */ - strftime(date, sizeof(date), "%b %e %T", tm); + strftime(date, sizeof(date), "%b %e %T", &tm); fprintf(eventlog, "%s asterisk[%d]: ", date, getpid()); va_start(ap, fmt); vfprintf(eventlog, fmt, ap); @@ -258,8 +258,8 @@ extern void ast_log(int level, const char *file, int line, const char *function, if (f->logflags & (1 << level) && f->f) { if ((f->f != stdout) && (f->f != stderr)) { time(&t); - tm = localtime(&t); - strftime(date, sizeof(date), "%b %e %T", tm); + localtime_r(&t,&tm); + strftime(date, sizeof(date), "%b %e %T", &tm); fprintf(f->f, "%s %s[%ld]: File %s, Line %d (%s): ", date, levels[level], pthread_self(), file, line, function); } else { sprintf(linestr, "%d", line); |