diff --git a/include/prototypes.h b/include/prototypes.h index 0cc0dd1f..2fd70b6b 100644 --- a/include/prototypes.h +++ b/include/prototypes.h @@ -307,8 +307,8 @@ extern int has_units_with_mob(coord, coord, natid); extern int adj_units(coord, coord, natid); extern int has_helpful_engineer(coord x, coord y, natid cn); /* log.c */ -extern void loginit(s_char *); -extern void logerror(s_char *, ...) ATTRIBUTE((format (printf, 1, 2))); +extern void loginit(char *); +extern void logerror(char *, ...) ATTRIBUTE((format (printf, 1, 2))); extern int oops(char *, char *, int); /* maps.c */ extern int draw_map(int, s_char, int, struct nstr_sect *, int); diff --git a/src/lib/common/log.c b/src/lib/common/log.c index 36e2b0d5..b402aeb7 100644 --- a/src/lib/common/log.c +++ b/src/lib/common/log.c @@ -46,30 +46,26 @@ #include "common.h" #include "optlist.h" -static s_char *logfile = 0; +static char logfile[32]; /* - * Points logfile at datadir/"program".log + * Points logfile at PROGRAM.log */ void -loginit(s_char *program) +loginit(char *program) { - s_char buf[1024]; - - sprintf(buf, "%s/%s.log", datadir, program); - logfile = malloc(strlen(buf) + 1); - strcpy(logfile, buf); + sprintf(logfile, "%.*s.log", (int)sizeof(logfile) - 5, program); } /*VARARGS*/ void -logerror(s_char *format, ...) +logerror(char *format, ...) { va_list list; time_t now; - s_char buf[512]; - s_char cbuf[512]; - s_char buf1[512]; + char buf[512]; + char cbuf[512]; + char buf1[512]; int logf; s_char *p;