mirror of git://anongit.mindrot.org/openssh.git
- (djm) OpenBSD CVS Sync
- djm@cvs.openbsd.org 2003/05/24 09:02:22 [log.c] pass logged data through strnvis; ok markus
This commit is contained in:
parent
6014578b90
commit
c11fe255ab
|
@ -1,3 +1,9 @@
|
|||
20030525
|
||||
- (djm) OpenBSD CVS Sync
|
||||
- djm@cvs.openbsd.org 2003/05/24 09:02:22
|
||||
[log.c]
|
||||
pass logged data through strnvis; ok markus
|
||||
|
||||
20030524
|
||||
- (dtucker) Correct --osfsia in INSTALL. Patch by skeleten at shillest.net
|
||||
|
||||
|
@ -1605,4 +1611,4 @@
|
|||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||
ok provos@
|
||||
|
||||
$Id: ChangeLog,v 1.2749 2003/05/24 01:41:16 dtucker Exp $
|
||||
$Id: ChangeLog,v 1.2750 2003/05/25 04:38:02 djm Exp $
|
||||
|
|
11
log.c
11
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);
|
||||
|
|
Loading…
Reference in New Issue