diff options
author | Damien Miller <djm@mindrot.org> | 2003-05-20 09:24:17 +1000 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2003-05-20 09:24:17 +1000 |
commit | 74a3442d10b875d73f770249844138856b87e4e9 (patch) | |
tree | 66353792a8e3a4784e1e02a4d22872c22554d541 | |
parent | eb0e969a4f68e3e63c8848f2aa29f575a3346f88 (diff) |
- deraadt@cvs.openbsd.org 2003/05/18 23:22:01
[log.c]
use syslog_r() in a signal handler called place; markus ok
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | log.c | 14 |
2 files changed, 19 insertions, 3 deletions
@@ -1,3 +1,9 @@ | |||
1 | 20030520 | ||
2 | - (djm) OpenBSD CVS Sync | ||
3 | - deraadt@cvs.openbsd.org 2003/05/18 23:22:01 | ||
4 | [log.c] | ||
5 | use syslog_r() in a signal handler called place; markus ok | ||
6 | |||
1 | 20030519 | 7 | 20030519 |
2 | - (djm) Sync auth-pam.h with what we actually implement | 8 | - (djm) Sync auth-pam.h with what we actually implement |
3 | 9 | ||
@@ -1578,4 +1584,4 @@ | |||
1578 | save auth method before monitor_reset_key_state(); bugzilla bug #284; | 1584 | save auth method before monitor_reset_key_state(); bugzilla bug #284; |
1579 | ok provos@ | 1585 | ok provos@ |
1580 | 1586 | ||
1581 | $Id: ChangeLog,v 1.2742 2003/05/19 01:28:44 djm Exp $ | 1587 | $Id: ChangeLog,v 1.2743 2003/05/19 23:24:17 djm Exp $ |
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | 35 | ||
36 | #include "includes.h" | 36 | #include "includes.h" |
37 | RCSID("$OpenBSD: log.c,v 1.26 2003/04/08 20:21:28 itojun Exp $"); | 37 | RCSID("$OpenBSD: log.c,v 1.27 2003/05/18 23:22:01 deraadt Exp $"); |
38 | 38 | ||
39 | #include "log.h" | 39 | #include "log.h" |
40 | #include "xmalloc.h" | 40 | #include "xmalloc.h" |
@@ -339,6 +339,9 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr) | |||
339 | void | 339 | void |
340 | do_log(LogLevel level, const char *fmt, va_list args) | 340 | do_log(LogLevel level, const char *fmt, va_list args) |
341 | { | 341 | { |
342 | #ifdef OPENLOG_R | ||
343 | struct syslog_data sdata = SYSLOG_DATA_INIT; | ||
344 | #endif | ||
342 | char msgbuf[MSGBUFSIZ]; | 345 | char msgbuf[MSGBUFSIZ]; |
343 | char fmtbuf[MSGBUFSIZ]; | 346 | char fmtbuf[MSGBUFSIZ]; |
344 | char *txt = NULL; | 347 | char *txt = NULL; |
@@ -391,10 +394,17 @@ do_log(LogLevel level, const char *fmt, va_list args) | |||
391 | strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_OCTAL); | 394 | strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_OCTAL); |
392 | 395 | ||
393 | if (log_on_stderr) { | 396 | if (log_on_stderr) { |
394 | fprintf(stderr, "%s\r\n", fmtbuf); | 397 | snprintf(fmtbuf, sizeof fmtbuf, "%s\r\n", msgbuf); |
398 | write(STDERR_FILENO, fmtbuf, strlen(fmtbuf)); | ||
395 | } else { | 399 | } else { |
400 | #ifdef OPENLOG_R | ||
401 | openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata); | ||
402 | syslog_r(pri, &sdata, "%.500s", msgbuf); | ||
403 | closelog_r(&sdata); | ||
404 | #else | ||
396 | openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); | 405 | openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility); |
397 | syslog(pri, "%.500s", fmtbuf); | 406 | syslog(pri, "%.500s", fmtbuf); |
398 | closelog(); | 407 | closelog(); |
408 | #endif | ||
399 | } | 409 | } |
400 | } | 410 | } |