From 654a23904b110744bd16c57554efd34624045470 Mon Sep 17 00:00:00 2001 From: pooler Date: Sun, 8 Apr 2012 20:32:44 +0200 Subject: [PATCH] Use syslog() instead of vsyslog() vsyslog() is not available on AIX and other platforms. --- util.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/util.c b/util.c index fef18bc..31991c5 100644 --- a/util.c +++ b/util.c @@ -69,7 +69,16 @@ void applog(int prio, const char *fmt, ...) #ifdef HAVE_SYSLOG_H 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 if (0) {}