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

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