diff options
author | markus@openbsd.org <markus@openbsd.org> | 2021-04-15 18:24:31 +0200 |
---|---|---|
committer | Damien Miller <djm@mindrot.org> | 2021-04-16 05:24:33 +0200 |
commit | faf2b86a46c9281d237bcdec18c99e94a4eb820a (patch) | |
tree | 31f662f8992fcde2c429d3cb6619f0be6349ae27 /log.c | |
parent | sshd don't exit on transient read errors (diff) | |
download | openssh-faf2b86a46c9281d237bcdec18c99e94a4eb820a.tar.xz openssh-faf2b86a46c9281d237bcdec18c99e94a4eb820a.zip |
upstream: do not pass file/func to monitor; noted by Ilja van Sprundel;
ok djm@
OpenBSD-Commit-ID: 85ae5c063845c410283cbdce685515dcd19479fa
Diffstat (limited to 'log.c')
-rw-r--r-- | log.c | 22 |
1 files changed, 16 insertions, 6 deletions
@@ -1,4 +1,4 @@ -/* $OpenBSD: log.c,v 1.57 2021/04/03 06:18:40 djm Exp $ */ +/* $OpenBSD: log.c,v 1.58 2021/04/15 16:24:31 markus Exp $ */ /* * Author: Tatu Ylonen <ylo@cs.hut.fi> * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland @@ -334,8 +334,8 @@ set_log_handler(log_handler_fn *handler, void *ctx) } static void -do_log(const char *file, const char *func, int line, LogLevel level, - int force, const char *suffix, const char *fmt, va_list args) +do_log(LogLevel level, int force, const char *suffix, const char *fmt, + va_list args) { #if defined(HAVE_OPENLOG_R) && defined(SYSLOG_DATA_INIT) struct syslog_data sdata = SYSLOG_DATA_INIT; @@ -400,7 +400,7 @@ do_log(const char *file, const char *func, int line, LogLevel level, /* Avoid recursion */ tmp_handler = log_handler; log_handler = NULL; - tmp_handler(file, func, line, level, fmtbuf, log_handler_ctx); + tmp_handler(level, force, fmtbuf, log_handler_ctx); log_handler = tmp_handler; } else if (log_on_stderr) { snprintf(msgbuf, sizeof msgbuf, "%.*s\r\n", @@ -475,12 +475,22 @@ sshlogv(const char *file, const char *func, int line, int showfunc, } } - if (log_handler == NULL && forced) + if (forced) snprintf(fmt2, sizeof(fmt2), "%s: %s", tag, fmt); else if (showfunc) snprintf(fmt2, sizeof(fmt2), "%s: %s", func, fmt); else strlcpy(fmt2, fmt, sizeof(fmt2)); - do_log(file, func, line, level, forced, suffix, fmt2, args); + do_log(level, forced, suffix, fmt2, args); +} + +void +sshlogdirect(LogLevel level, int forced, const char *fmt, ...) +{ + va_list args; + + va_start(args, fmt); + do_log(level, forced, NULL, fmt, args); + va_end(args); } |