+2008-06-04 Guillem Jover <guillem@debian.org>
+
+ * lib/log.c (log_message): Switch log from a pointer to struct varbuf
+ to just struct varbuf.
+
2008-06-04 Guillem Jover <guillem@debian.org>
* src/main.c (setpipe): Fix the setting of more than one pipef.
void
log_message(const char *fmt, ...)
{
- static struct varbuf *log = NULL;
+ static struct varbuf log;
static FILE *logfd = NULL;
char time_str[20];
time_t now;
setcloexec(fileno(logfd), log_file);
}
- if (!log) {
- log = nfmalloc(sizeof(struct varbuf));
- varbufinit(log);
- } else
- varbufreset(log);
-
va_start(al, fmt);
- varbufvprintf(log, fmt, al);
- varbufaddc(log, 0);
+ varbufreset(&log);
+ varbufvprintf(&log, fmt, al);
+ varbufaddc(&log, 0);
va_end(al);
time(&now);
strftime(time_str, sizeof(time_str), "%Y-%m-%d %H:%M:%S",
localtime(&now));
- fprintf(logfd, "%s %s\n", time_str, log->buf);
+ fprintf(logfd, "%s %s\n", time_str, log.buf);
}
struct pipef *status_pipes = NULL;