Use syslog() instead of vsyslog()

vsyslog() is not available on AIX and other platforms.
This commit is contained in:
pooler 2012-04-08 20:32:44 +02:00
parent e0867338ab
commit 654a23904b

11
util.c
View file

@ -69,7 +69,16 @@ void applog(int prio, const char *fmt, ...)
#ifdef HAVE_SYSLOG_H #ifdef HAVE_SYSLOG_H
if (use_syslog) { if (use_syslog) {
vsyslog(prio, fmt, ap); va_list ap2;
char *buf;
int len;
va_copy(ap2, ap);
len = vsnprintf(NULL, 0, fmt, ap2) + 1;
va_end(ap2);
buf = alloca(len);
if (vsnprintf(buf, len, fmt, ap) >= 0)
syslog(prio, "%s", buf);
} }
#else #else
if (0) {} if (0) {}