summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDamien Miller <djm@mindrot.org>2003-05-20 09:24:17 +1000
committerDamien Miller <djm@mindrot.org>2003-05-20 09:24:17 +1000
commit74a3442d10b875d73f770249844138856b87e4e9 (patch)
tree66353792a8e3a4784e1e02a4d22872c22554d541
parenteb0e969a4f68e3e63c8848f2aa29f575a3346f88 (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--ChangeLog8
-rw-r--r--log.c14
2 files changed, 19 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index f65ff5a4c..814da4483 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
120030520
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
120030519 720030519
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 $
diff --git a/log.c b/log.c
index bc9a2dc1b..6bbae32da 100644
--- a/log.c
+++ b/log.c
@@ -34,7 +34,7 @@
34 */ 34 */
35 35
36#include "includes.h" 36#include "includes.h"
37RCSID("$OpenBSD: log.c,v 1.26 2003/04/08 20:21:28 itojun Exp $"); 37RCSID("$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)
339void 339void
340do_log(LogLevel level, const char *fmt, va_list args) 340do_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}