- (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
|
20030524
|
||||||
- (dtucker) Correct --osfsia in INSTALL. Patch by skeleten at shillest.net
|
- (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;
|
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||||
ok provos@
|
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"
|
#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 "log.h"
|
||||||
#include "xmalloc.h"
|
#include "xmalloc.h"
|
||||||
|
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
|
#include <vis.h>
|
||||||
|
|
||||||
static LogLevel log_level = SYSLOG_LEVEL_INFO;
|
static LogLevel log_level = SYSLOG_LEVEL_INFO;
|
||||||
static int log_on_stderr = 1;
|
static int log_on_stderr = 1;
|
||||||
|
@ -390,16 +391,14 @@ do_log(LogLevel level, const char *fmt, va_list args)
|
||||||
} else {
|
} else {
|
||||||
vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
|
vsnprintf(msgbuf, sizeof(msgbuf), fmt, args);
|
||||||
}
|
}
|
||||||
/* Escape magic chars in output. */
|
|
||||||
strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL);
|
strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_SAFE|VIS_OCTAL);
|
||||||
|
|
||||||
if (log_on_stderr) {
|
if (log_on_stderr) {
|
||||||
snprintf(fmtbuf, sizeof fmtbuf, "%s\r\n", msgbuf);
|
snprintf(msgbuf, sizeof msgbuf, "%s\r\n", fmtbuf);
|
||||||
write(STDERR_FILENO, fmtbuf, strlen(fmtbuf));
|
write(STDERR_FILENO, msgbuf, strlen(msgbuf));
|
||||||
} else {
|
} else {
|
||||||
#ifdef OPENLOG_R
|
#ifdef OPENLOG_R
|
||||||
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
|
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);
|
closelog_r(&sdata);
|
||||||
#else
|
#else
|
||||||
openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
|
openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
|
||||||
|
|
Loading…
Reference in New Issue