diff mbox series

[v2,3/5] setfiles: remove useless "iamrestorecon" checks in option parsing

Message ID 20220503082326.11621-4-lersek@redhat.com (mailing list archive)
State Accepted
Commit b98626f15fe9
Headers show
Series selinux_restorecon(3), setfiles(8): skip relabeling errors | expand

Commit Message

Laszlo Ersek May 3, 2022, 8:23 a.m. UTC
Commit 219eea83cea9 ("policycoreutils: setfiles/restorecon: fix -r/-R
option", 2015-04-16) split the option strings between "setfiles" and
"restorecon". Since that commit, an "iamrestorecon" check has only been
necessary for an option that is (a) accepted by both "setfiles" and
"restorecon", but (b) behaves differently between "setfiles" and
"restorecon". Currently, the only such options are "-r" and "-R". Remove
the "iamrestorecon" checks from the "setfiles"-only "-c" and "-d" options,
and from the "restorecon"-only "-x" option.

Cc: "Richard W.M. Jones" <rjones@redhat.com>
Cc: Petr Lautrbach <plautrba@redhat.com>
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1794518
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-By: Daniel Burgener <dburgener@linux.microsoft.com>
---

Notes:
    v2:
    
    - pick up Daniel Burgener's R-b

 policycoreutils/setfiles/setfiles.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)
diff mbox series

Patch

diff --git a/policycoreutils/setfiles/setfiles.c b/policycoreutils/setfiles/setfiles.c
index cf504618d38f..aeec1fdcc2ab 100644
--- a/policycoreutils/setfiles/setfiles.c
+++ b/policycoreutils/setfiles/setfiles.c
@@ -227,9 +227,6 @@  int main(int argc, char **argv)
 			{
 				FILE *policystream;
 
-				if (iamrestorecon)
-					usage(argv[0]);
-
 				policyfile = optarg;
 
 				policystream = fopen(policyfile, "r");
@@ -267,8 +264,6 @@  int main(int argc, char **argv)
 			input_filename = optarg;
 			break;
 		case 'd':
-			if (iamrestorecon)
-				usage(argv[0]);
 			r_opts.debug = 1;
 			r_opts.log_matches =
 					   SELINUX_RESTORECON_LOG_MATCHES;
@@ -367,11 +362,7 @@  int main(int argc, char **argv)
 			null_terminated = 1;
 			break;
 		case 'x':
-			if (iamrestorecon) {
-				r_opts.xdev = SELINUX_RESTORECON_XDEV;
-			} else {
-				usage(argv[0]);
-			}
+			r_opts.xdev = SELINUX_RESTORECON_XDEV;
 			break;
 		case 'T':
 			nthreads = strtoull(optarg, &endptr, 10);