diff options
author | Damien Miller <djm@cvs.openbsd.org> | 2023-12-06 21:06:49 +0000 |
---|---|---|
committer | Damien Miller <djm@cvs.openbsd.org> | 2023-12-06 21:06:49 +0000 |
commit | 77b1671150ec9dd3e094d2c59bd247182ea4c5e5 (patch) | |
tree | eac288c48f1ff3add32719dab2a6c9fd66bbbe2b /usr.bin/ssh | |
parent | c663198273969229894d0555039ba2c231c0ba17 (diff) |
short circuit debug log processing early if we're not going to
log anything. From Kobe Housen
Diffstat (limited to 'usr.bin/ssh')
-rw-r--r-- | usr.bin/ssh/log.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/usr.bin/ssh/log.c b/usr.bin/ssh/log.c index dd704437a9e..57d7d166b5d 100644 --- a/usr.bin/ssh/log.c +++ b/usr.bin/ssh/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 @@ -427,6 +427,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()); |