From: Peep P. <so...@us...> - 2004-03-21 12:35:09
|
Update of /cvsroot/agd/server/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18692 Modified Files: log.c Log Message: Fixed crasher. Index: log.c =================================================================== RCS file: /cvsroot/agd/server/src/log.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- log.c 21 Mar 2004 10:35:53 -0000 1.5 +++ log.c 21 Mar 2004 12:24:36 -0000 1.6 @@ -1,5 +1,7 @@ -#include "std.h" +#include <stdio.h> +#include "sys.h" #include <stdarg.h> +#include <time.h> /* To prevent flooding the user with error messages. */ static int suppress_nofd, /* If we have a file descriptor. */ @@ -54,7 +56,7 @@ #endif #endif -#define WRITELOG(x) fprintf(x, "%s [%s] %s", ctime(time(NULL)), prefix, str) +#define WRITELOG(x) time(&t); fprintf(x, "%s [%s] %s", ctime(&t), prefix, str) /* this currently writes the errors into a generic error log, maybe we should write them into separate files */ @@ -63,6 +65,7 @@ { char str[512]; va_list va; + time_t t; va_start(va, fmt); vsprintf(str, fmt, va); @@ -70,8 +73,9 @@ str[strlen(str)+1] = '\0'; - if(/*!strcmp(prefix, "crash") ||*/ conf.debuglevel > 1) + if(/*!strcmp(prefix, "crash") ||*/ conf.debuglevel > 1) { WRITELOG(stderr); + } if(!logfile && !check_logfile()) return; |