From d792f15ff1406cde7f38ddc5febb08a8b39b90e8 Mon Sep 17 00:00:00 2001 From: Ralph Boehme Date: Wed, 12 Dec 2018 14:54:41 +0100 Subject: [PATCH] debug: update need_to_check_log_size() for per debug-class logfiles Signed-off-by: Ralph Boehme Reviewed-by: Jeremy Allison --- lib/util/debug.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/lib/util/debug.c b/lib/util/debug.c index c315222a9bb..fb4332f4273 100644 --- a/lib/util/debug.c +++ b/lib/util/debug.c @@ -1187,17 +1187,30 @@ _PUBLIC_ void debug_schedule_reopen_logs(void) bool need_to_check_log_size(void) { int maxlog; + size_t i; if (debug_count < 100) { return false; } maxlog = state.settings.max_log_size * 1024; - if (state.fd <= 2 || maxlog <= 0) { + if (maxlog <= 0) { debug_count = 0; return false; } - return true; + + if (state.fd > 2) { + return true; + } + + for (i = DBGC_ALL + 1; i < debug_num_classes; i++) { + if (dbgc_config[i].fd != -1) { + return true; + } + } + + debug_count = 0; + return false; } /**************************************************************************