summaryrefslogtreecommitdiffstats
path: root/log.c
diff options
context:
space:
mode:
authordjm@openbsd.org <djm@openbsd.org>2023-12-06 22:06:48 +0100
committerDamien Miller <djm@mindrot.org>2023-12-06 22:09:11 +0100
commit19d3ee2f3adf7d9a606ff015c1e153744702c4c9 (patch)
tree071b2ccea15b00f2a02c66f091d0d7be12e78556 /log.c
parentAdd tests for OpenSSL 3.2.0 and 3.2 stable branch. (diff)
downloadopenssh-19d3ee2f3adf7d9a606ff015c1e153744702c4c9.tar.xz
openssh-19d3ee2f3adf7d9a606ff015c1e153744702c4c9.zip
upstream: short circuit debug log processing early if we're not going
to log anything. From Kobe Housen OpenBSD-Commit-ID: 2bcddd695872a1bef137cfff7823044dcded90ea
Diffstat (limited to 'log.c')
-rw-r--r--log.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/log.c b/log.c
index 99bf046a7..9fc1a2e2e 100644
--- a/log.c
+++ b/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.60 2021/09/16 15:11:19 djm Exp $ */
+/* $OpenBSD: log.c,v 1.61 2023/12/06 21:06:48 djm Exp $ */
/*
* Author: Tatu Ylonen <ylo@cs.hut.fi>
* Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -469,6 +469,10 @@ sshlogv(const char *file, const char *func, int line, int showfunc,
const char *cp;
size_t i;
+ /* short circuit processing early if we're not going to log anything */
+ if (nlog_verbose == 0 && level > log_level)
+ return;
+
snprintf(tag, sizeof(tag), "%.48s:%.48s():%d (pid=%ld)",
(cp = strrchr(file, '/')) == NULL ? file : cp + 1, func, line,
(long)getpid());