зеркало из https://github.com/Azure/sonic-openssh.git
- deraadt@cvs.openbsd.org 2003/05/18 23:22:01
[log.c] use syslog_r() in a signal handler called place; markus ok
This commit is contained in:
Родитель
eb0e969a4f
Коммит
74a3442d10
|
@ -1,3 +1,9 @@
|
|||
20030520
|
||||
- (djm) OpenBSD CVS Sync
|
||||
- deraadt@cvs.openbsd.org 2003/05/18 23:22:01
|
||||
[log.c]
|
||||
use syslog_r() in a signal handler called place; markus ok
|
||||
|
||||
20030519
|
||||
- (djm) Sync auth-pam.h with what we actually implement
|
||||
|
||||
|
@ -1578,4 +1584,4 @@
|
|||
save auth method before monitor_reset_key_state(); bugzilla bug #284;
|
||||
ok provos@
|
||||
|
||||
$Id: ChangeLog,v 1.2742 2003/05/19 01:28:44 djm Exp $
|
||||
$Id: ChangeLog,v 1.2743 2003/05/19 23:24:17 djm Exp $
|
||||
|
|
14
log.c
14
log.c
|
@ -34,7 +34,7 @@
|
|||
*/
|
||||
|
||||
#include "includes.h"
|
||||
RCSID("$OpenBSD: log.c,v 1.26 2003/04/08 20:21:28 itojun Exp $");
|
||||
RCSID("$OpenBSD: log.c,v 1.27 2003/05/18 23:22:01 deraadt Exp $");
|
||||
|
||||
#include "log.h"
|
||||
#include "xmalloc.h"
|
||||
|
@ -339,6 +339,9 @@ log_init(char *av0, LogLevel level, SyslogFacility facility, int on_stderr)
|
|||
void
|
||||
do_log(LogLevel level, const char *fmt, va_list args)
|
||||
{
|
||||
#ifdef OPENLOG_R
|
||||
struct syslog_data sdata = SYSLOG_DATA_INIT;
|
||||
#endif
|
||||
char msgbuf[MSGBUFSIZ];
|
||||
char fmtbuf[MSGBUFSIZ];
|
||||
char *txt = NULL;
|
||||
|
@ -391,10 +394,17 @@ do_log(LogLevel level, const char *fmt, va_list args)
|
|||
strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), VIS_OCTAL);
|
||||
|
||||
if (log_on_stderr) {
|
||||
fprintf(stderr, "%s\r\n", fmtbuf);
|
||||
snprintf(fmtbuf, sizeof fmtbuf, "%s\r\n", msgbuf);
|
||||
write(STDERR_FILENO, fmtbuf, strlen(fmtbuf));
|
||||
} else {
|
||||
#ifdef OPENLOG_R
|
||||
openlog_r(argv0 ? argv0 : __progname, LOG_PID, log_facility, &sdata);
|
||||
syslog_r(pri, &sdata, "%.500s", msgbuf);
|
||||
closelog_r(&sdata);
|
||||
#else
|
||||
openlog(argv0 ? argv0 : __progname, LOG_PID, log_facility);
|
||||
syslog(pri, "%.500s", fmtbuf);
|
||||
closelog();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче