Blame SOURCES/0016-libsepol-cil-Report-disabling-an-optional-block-only.patch

060220
From 2f9ce13779d3b92198e60cdbd3d19e7c08b5457f Mon Sep 17 00:00:00 2001
060220
From: James Carter <jwcart2@tycho.nsa.gov>
060220
Date: Fri, 1 Nov 2019 09:50:53 -0400
060220
Subject: [PATCH] libsepol/cil: Report disabling an optional block only at high
060220
 verbose levels
060220
060220
Since failing to resolve a statement in an optional block is normal,
060220
only display messages about the statement failing to resolve and the
060220
optional block being disabled at the highest verbosity level.
060220
060220
These messages are now only at log level CIL_INFO instead of CIL_WARN.
060220
060220
Signed-off-by: James Carter <jwcart2@tycho.nsa.gov>
060220
---
060220
 libsepol/cil/src/cil_resolve_ast.c | 6 ++++--
060220
 1 file changed, 4 insertions(+), 2 deletions(-)
060220
060220
diff --git a/libsepol/cil/src/cil_resolve_ast.c b/libsepol/cil/src/cil_resolve_ast.c
060220
index 91e08633..dab8b276 100644
060220
--- a/libsepol/cil/src/cil_resolve_ast.c
060220
+++ b/libsepol/cil/src/cil_resolve_ast.c
060220
@@ -3765,14 +3765,16 @@ int __cil_resolve_ast_node_helper(struct cil_tree_node *node, uint32_t *finished
060220
 		enum cil_log_level lvl = CIL_ERR;
060220
 
060220
 		if (optstack != NULL) {
060220
-			lvl = CIL_WARN;
060220
+			lvl = CIL_INFO;
060220
 
060220
 			struct cil_optional *opt = (struct cil_optional *)optstack->data;
060220
 			struct cil_tree_node *opt_node = opt->datum.nodes->head->data;
060220
-			cil_tree_log(opt_node, lvl, "Disabling optional '%s'", opt->datum.name);
060220
 			/* disable an optional if something failed to resolve */
060220
 			opt->enabled = CIL_FALSE;
060220
+			cil_tree_log(node, lvl, "Failed to resolve %s statement", cil_node_to_string(node));
060220
+			cil_tree_log(opt_node, lvl, "Disabling optional '%s'", opt->datum.name);
060220
 			rc = SEPOL_OK;
060220
+			goto exit;
060220
 		}
060220
 
060220
 		cil_tree_log(node, lvl, "Failed to resolve %s statement", cil_node_to_string(node));
060220
-- 
060220
2.30.2
060220