[PATCH] libsepol/cil: Remove duplicated 'if' condition in cil_tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Binderman wrote:
> Hello there,
>
> ./cil/src/cil_tree.c:1279:36: warning: duplicated 'if' condition [-Wduplicated-cond]
>
> Source code is
>
>             if (filecon->context_str != NULL) {
>                 cil_log(CIL_INFO, " %s", filecon->context_str);
>             } else if (filecon->context != NULL) {
>                 cil_tree_print_context(filecon->context);
>             } else if (filecon->context_str != NULL) {
>                 cil_log(CIL_INFO, " %s", filecon->context_str);
>             }
>
> Two mentions of filecon->context_str. Suggest code rework.

Reported-by: David Binderman <dcb314@xxxxxxxxxxx>
Signed-off-by: Steve Lawrence <slawrence@xxxxxxxxxx>
---
 libsepol/cil/src/cil_tree.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/libsepol/cil/src/cil_tree.c b/libsepol/cil/src/cil_tree.c
index f641baa..8357a32 100644
--- a/libsepol/cil/src/cil_tree.c
+++ b/libsepol/cil/src/cil_tree.c
@@ -1302,9 +1302,7 @@ void cil_tree_print_node(struct cil_tree_node *node)
 			cil_log(CIL_INFO, "FILECON:");
 			cil_log(CIL_INFO, " %s %d", filecon->path_str, filecon->type);
 
-			if (filecon->context_str != NULL) {
-				cil_log(CIL_INFO, " %s", filecon->context_str);
-			} else if (filecon->context != NULL) {
+			if (filecon->context != NULL) {
 				cil_tree_print_context(filecon->context);
 			} else if (filecon->context_str != NULL) {
 				cil_log(CIL_INFO, " %s", filecon->context_str);
-- 
2.4.3

_______________________________________________
Selinux mailing list
Selinux@xxxxxxxxxxxxx
To unsubscribe, send email to Selinux-leave@xxxxxxxxxxxxx.
To get help, send an email containing "help" to Selinux-request@xxxxxxxxxxxxx.



[Index of Archives]     [Selinux Refpolicy]     [Linux SGX]     [Fedora Users]     [Fedora Desktop]     [Yosemite Photos]     [Yosemite Camping]     [Yosemite Campsites]     [KDE Users]     [Gnome Users]

  Powered by Linux