aboutsummaryrefslogtreecommitdiffstats
path: root/logger.c
diff options
context:
space:
mode:
authormarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-03-31 03:19:34 +0000
committermarkster <markster@f38db490-d61c-443f-a65b-d21fe96a405b>2003-03-31 03:19:34 +0000
commitd53be73ebe9f97b545594f1c2db16926aaddf524 (patch)
tree06b9e7ecdef28acd64e8fe5614020f23b743687f /logger.c
parente0c466aa42beff5788490914ece124091e8a7da7 (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-xlogger.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/logger.c b/logger.c
index fac8dc13b..66375de27 100755
--- a/logger.c
+++ b/logger.c
@@ -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);