summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
Diffstat (limited to 'log.c')
-rw-r--r--log.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/log.c b/log.c
index 96626d7d4..ead7e9028 100644
--- a/log.c
+++ b/log.c
@@ -386,11 +386,14 @@ do_log(LogLevel level, const char *fmt, va_list args)
386 } else { 386 } else {
387 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); 387 vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
388 } 388 }
389 /* Escape magic chars in output. */
390 strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_OCTAL);
391
389 if (log_on_stderr) { 392 if (log_on_stderr) {
390 fprintf(stderr, "%s\r\n", msgbuf); 393 fprintf(stderr, "%s\r\n", fmtbuf);
391 } else { 394 } else {
392 openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); 395 openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
393 syslog(pri, "%.500s", msgbuf); 396 syslog(pri, "%.500s", fmtbuf);
394 closelog(); 397 closelog();
395 } 398 }
396} 399}