X-Git-Url: https://the.earth.li/gitweb/?a=blobdiff_plain;f=log.c;h=7c6f2eeee5312e3e6e5dfd21fc4b976db5d2bc15;hb=76f079e5ebdb34acaaa2462a8d915ee06d3c8425;hp=45ec17e01bfef44420a52834034043594bfa5982;hpb=6df51fef2960f533a741fb7290867387ed3fbba5;p=onak.git diff --git a/log.c b/log.c index 45ec17e..7c6f2ee 100644 --- a/log.c +++ b/log.c @@ -133,19 +133,19 @@ loglevels getlogthreshold(void) */ static void vflog(FILE *logfile, const char *format, va_list ap) { - struct tm *timestamp = NULL; - time_t timer = 0; + struct tm timestamp; + time_t timer = 0; timer = time(NULL); - timestamp = localtime(&timer); + localtime_r(&timer, ×tamp); fprintf(logfile, "[%02d/%02d/%4d %02d:%02d:%02d] %s[%d]: ", - timestamp->tm_mday, - timestamp->tm_mon + 1, - timestamp->tm_year + 1900, - timestamp->tm_hour, - timestamp->tm_min, - timestamp->tm_sec, + timestamp.tm_mday, + timestamp.tm_mon + 1, + timestamp.tm_year + 1900, + timestamp.tm_hour, + timestamp.tm_min, + timestamp.tm_sec, (logappname == NULL) ? "" : logappname, getpid()); vfprintf(logfile, format, ap);