X-Git-Url: http://the.earth.li/gitweb/?p=onak.git;a=blobdiff_plain;f=log.c;h=7c6f2eeee5312e3e6e5dfd21fc4b976db5d2bc15;hp=8ab5e96526b916283efe06e01b966c9eed7534d0;hb=97be85bfba76b9ed0aa6ad01afc7c6efc4b370d5;hpb=252f4d4b16eee6e61f0675f65069216cc37805c4 diff --git a/log.c b/log.c index 8ab5e96..7c6f2ee 100644 --- a/log.c +++ b/log.c @@ -13,8 +13,7 @@ * more details. * * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * this program. If not, see . */ #include @@ -134,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);