Skip to content

Commit

Permalink
upstream: short circuit debug log processing early if we're not going
Browse files Browse the repository at this point in the history
to log anything. From Kobe Housen

OpenBSD-Commit-ID: 2bcddd695872a1bef137cfff7823044dcded90ea
  • Loading branch information
djmdjm committed Dec 6, 2023
1 parent 947affa commit 19d3ee2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion log.c
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
* Copyright (c) 1995 Tatu Ylonen <[email protected]>, Espoo, Finland
Expand Down Expand Up @@ -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());
Expand Down

0 comments on commit 19d3ee2

Please sign in to comment.