]> andersk Git - openssh.git/blobdiff - log.c
- (djm) [log.c] bz #111: Escape more control characters when sending data
[openssh.git] / log.c
diff --git a/log.c b/log.c
index 0c4d5123a63bc1086a07826ece393cacabb73de2..5d8625d15a1144ffc5c1d0a57d17ef4e6311c7cf 100644 (file)
--- a/log.c
+++ b/log.c
@@ -51,6 +51,9 @@ static char *argv0;
 
 extern char *__progname;
 
+#define LOG_SYSLOG_VIS (VIS_CSTYLE|VIS_NL|VIS_TAB|VIS_OCTAL)
+#define LOG_STDERR_VIS (VIS_SAFE|VIS_OCTAL)
+
 /* textual representation of log-facilities/levels */
 
 static struct {
@@ -316,7 +319,8 @@ do_log(LogLevel level, const char *fmt, va_list args)
        } else {
                vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
        }
-       strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL);
+       strnvis(fmtbuf, msgbuf, sizeof(fmtbuf),
+           log_on_stderr ? LOG_STDERR_VIS : LOG_SYSLOG_VIS);
        if (log_on_stderr) {
                snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
                write(STDERR_FILENO, msgbuf, strlen(msgbuf));
This page took 0.031962 seconds and 4 git commands to generate.