libselinux/setexecfilecon: Remove useless rc check

Fixes:
 Error: IDENTICAL_BRANCHES (CWE-398):
 libselinux-3.6/src/setexecfilecon.c:45: implicit_else: The code from the above if-then branch is identical to the code after the if statement.
 libselinux-3.6/src/setexecfilecon.c:43: identical_branches: The same code is executed when the condition "rc < 0" is true or false, because the code in the if-then branch and after the if statement is identical. Should the if statement be removed?
 \#   41|
 \#   42|           rc = setexeccon(newcon);
 \#   43|->         if (rc < 0)
 \#   44|                   goto out;
 \#   45|         out:

Signed-off-by: Vit Mojzis <vmojzis@redhat.com>
Acked-by: James Carter <jwcart2@gmail.com>
This commit is contained in:
Vit Mojzis 2024-10-25 20:30:13 +02:00 committed by James Carter
parent b33da68f7a
commit 33ac7c960f

View File

@ -40,8 +40,6 @@ int setexecfilecon(const char *filename, const char *fallback_type)
}
rc = setexeccon(newcon);
if (rc < 0)
goto out;
out:
if (rc < 0 && security_getenforce() == 0)