Skip to content

Commit

Permalink
Use syslog() instead of vsyslog()
Browse files Browse the repository at this point in the history
vsyslog() is not available on AIX and other platforms.
  • Loading branch information
pooler committed Apr 8, 2012
1 parent e086733 commit 654a239
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down

0 comments on commit 654a239

Please sign in to comment.