Commit b2965329 authored by Leigh B. Stoller's avatar Leigh B. Stoller
Browse files

Minor structural change to reduce chance of intermixed output

statements from the two threads.
parent d0c50b3e
...@@ -41,17 +41,18 @@ void ...@@ -41,17 +41,18 @@ void
log(const char *fmt, ...) log(const char *fmt, ...)
{ {
va_list args; va_list args;
char buf[BUFSIZ];
va_start(args, fmt); va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
va_end(args);
if (!usesyslog) { if (!usesyslog) {
vfprintf(stderr, fmt, args); fputs(buf, stderr);
fputc('\n', stderr); fputc('\n', stderr);
fflush(stderr);
} }
else else
vsyslog(LOG_INFO, fmt, args); syslog(LOG_INFO, "%s", buf);
va_end(args);
} }
void void
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment