https://fedorahosted.org/sssd/ticket/1345
https://bugzilla.redhat.com/show_bug.cgi?id=824244

With this patch, macro DEBUG_IS_SET returns true if debug_level has value SSSDBG_UNRESOLVED and the message is of level SSSDBG_CRITICAL_FAILURE or SSSDBG_FATAL_FAILURE.

Patch is in attachment.

Thanks
Michal
>From 616a071a88804c68eba5d12a9fd1849d03c50a95 Mon Sep 17 00:00:00 2001
From: Michal Zidek <mzi...@redhat.com>
Date: Mon, 19 Nov 2012 13:10:39 +0100
Subject: [PATCH] debug: print fatal and critical errors if debug level is
 unresolved

If global variable debug_level has value SSSDBG_UNRESOLVED, we should
print at least fatal and critical errors.

https://fedorahosted.org/sssd/ticket/1345
---
 src/monitor/monitor.c | 6 ------
 src/util/util.h       | 5 ++++-
 2 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/src/monitor/monitor.c b/src/monitor/monitor.c
index caa1571..d20933c 100644
--- a/src/monitor/monitor.c
+++ b/src/monitor/monitor.c
@@ -2706,12 +2706,6 @@ int main(int argc, const char *argv[])
     /* Parse config file, fail if cannot be done */
     ret = load_configuration(tmp_ctx, config_file, &monitor);
     if (ret != EOK) {
-        /* if debug level has not been set, set it manually to make these
-         * critical failures visible */
-        if (debug_level == SSSDBG_UNRESOLVED) {
-            debug_level = SSSDBG_MASK_ALL;
-        }
-
         if (ret == EPERM) {
             DEBUG(1, ("Cannot read configuration file %s\n", config_file));
             sss_log(SSS_LOG_ALERT,
diff --git a/src/util/util.h b/src/util/util.h
index 2d63e73..75ac771 100644
--- a/src/util/util.h
+++ b/src/util/util.h
@@ -193,7 +193,10 @@ errno_t set_debug_file_from_fd(const int fd);
 
     \param level the debug level, please use one of the SSSDBG*_ macros
 */
-#define DEBUG_IS_SET(level) (debug_level & (level))
+#define DEBUG_IS_SET(level) (debug_level & (level) || \
+                            (debug_level == SSSDBG_UNRESOLVED && \
+                                            (level & (SSSDBG_FATAL_FAILURE | \
+                                                      SSSDBG_CRIT_FAILURE))))
 
 #define DEBUG_INIT(dbg_lvl) do { \
     if (dbg_lvl != SSSDBG_INVALID) { \
-- 
1.7.11.2

_______________________________________________
sssd-devel mailing list
sssd-devel@lists.fedorahosted.org
https://lists.fedorahosted.org/mailman/listinfo/sssd-devel

Reply via email to