summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authormarkus@openbsd.org <markus@openbsd.org>2021-04-15 18:24:31 +0200
committerDamien Miller <djm@mindrot.org>2021-04-16 05:24:33 +0200
commitfaf2b86a46c9281d237bcdec18c99e94a4eb820a (patch)
tree31f662f8992fcde2c429d3cb6619f0be6349ae27 /log.c
parentsshd don't exit on transient read errors (diff)
downloadopenssh-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.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/log.c b/log.c
index 36ab284d6..165b48638 100644
--- a/log.c
+++ b/log.c
@@ -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);
}