diff --git a/lib/isc/log.c b/lib/isc/log.c index 4b7d877f3a..fcf387e94e 100644 --- a/lib/isc/log.c +++ b/lib/isc/log.c @@ -1454,13 +1454,15 @@ isc_log_wouldlog(isc_log_t *lctx, int level) { return (false); } - if (level <= atomic_load_acquire(&lctx->highest_level)) { + int highest_level = atomic_load_acquire(&lctx->highest_level); + if (level <= highest_level) { return (true); } - if (atomic_load_acquire(&lctx->dynamic) && - level <= atomic_load_acquire(&lctx->debug_level)) - { - return (true); + if (atomic_load_acquire(&lctx->dynamic)) { + int debug_level = atomic_load_acquire(&lctx->debug_level); + if (level <= debug_level) { + return (true); + } } return (false);