summaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-25 14:38:02 +1000
committerDamien Miller <djm@mindrot.org>2003-05-25 14:38:02 +1000
commitc11fe255ab45b8cf7783cedbcd688b00ed5308aa (patch)
tree77652962b77cf40acd1f800d0745c0f97a4a5df1 /log.c
parent6014578b90a6cad5104b05c4449aec07756be033 (diff)
- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2003/05/24 09:02:22 [log.c] pass logged data through strnvis; ok markus
Diffstat (limited to 'log.c')
-rw-r--r--log.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/log.c b/log.c
index 5a28438f..fb89a965 100644
--- a/log.c
+++ b/log.c
@@ -34,12 +34,13 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: log.c,v 1.27 2003/05/18 23:22:01 deraadt Exp $");
+RCSID("$OpenBSD: log.c,v 1.28 2003/05/24 09:02:22 djm Exp $");
#include "log.h"
#include "xmalloc.h"
#include <syslog.h>
+#include <vis.h>
static LogLevel log_level = SYSLOG_LEVEL_INFO;
static int log_on_stderr = 1;
@@ -390,16 +391,14 @@ do_log(LogLevel level, const char *fmt, va_list args)
} else {
vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
}
- /* Escape magic chars in output. */
strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL);
-
if (log_on_stderr) {
- snprintf(fmtbuf, sizeof fmtbuf, "%s\r\n", msgbuf);
- write(STDERR_FILENO, fmtbuf, strlen(fmtbuf));
+ snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
+ write(STDERR_FILENO, msgbuf, strlen(msgbuf));
} else {
#ifdef OPENLOG_R
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
- syslog_r(pri, &sdata, "%.500s", msgbuf);
+ syslog_r(pri, &sdata, "%.500s", fmtbuf);
closelog_r(&sdata);
#else
openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);