[PATCH 30/73] policycoreutils: restorecond: wrong options should

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

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


   This patch looks good to me. acked.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk9x2VsACgkQrlYvE4MpobNz7ACgnnDlAVBP1gbUqPuChtiWULie
g6wAnjVPquk+V/wSSh+ATqLPeacXkc8d
=Gu1l
-----END PGP SIGNATURE-----
>From 5b6f38a02928efe874325357af81fd7cbfb08015 Mon Sep 17 00:00:00 2001
From: Dan Walsh <dwalsh@xxxxxxxxxx>
Date: Tue, 24 Jan 2012 11:22:43 -0500
Subject: [PATCH 30/73] policycoreutils: restorecond: wrong options should
 exit with a non zero exit code. FIXME

Add -h option to get usage command

[SPLIT THIS INTO TWO PATCHES]

NOT-Signed-off-by: Eric Paris <eparis@xxxxxxxxxx>
---
 policycoreutils/restorecond/restorecond.8 |    5 ++++-
 policycoreutils/restorecond/restorecond.c |    8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/policycoreutils/restorecond/restorecond.8 b/policycoreutils/restorecond/restorecond.8
index 4622d2b..bf8ec87 100644
--- a/policycoreutils/restorecond/restorecond.8
+++ b/policycoreutils/restorecond/restorecond.8
@@ -3,7 +3,7 @@
 restorecond \- daemon that watches for file creation and then sets the default SELinux file context
 
 .SH "SYNOPSIS"
-.B restorecond  [\-d] [\-f restorecond_file ] [\-u] [\-v]
+.B restorecond  [\-d] [-h] [\-f restorecond_file ] [\-u] [\-v]
 .P
 
 .SH "DESCRIPTION"
@@ -20,6 +20,9 @@ the correct file context associated with the policy.
 Turns on debugging mode.   Application will stay in the foreground and lots of
 debugs messages start printing.
 .TP
+. B \-h
+Print usage statement.
+.TP
 .B \-f restorecond_file
 Use alternative restorecond.conf file.
 .TP
diff --git a/policycoreutils/restorecond/restorecond.c b/policycoreutils/restorecond/restorecond.c
index dfd9629..1762850 100644
--- a/policycoreutils/restorecond/restorecond.c
+++ b/policycoreutils/restorecond/restorecond.c
@@ -121,7 +121,6 @@ static void term_handler()
 static void usage(char *program)
 {
 	printf("%s [-d] [-f restorecond_file ] [-u] [-v] \n", program);
-	exit(0);
 }
 
 void exitApp(const char *msg)
@@ -178,7 +177,7 @@ int main(int argc, char **argv)
 
 	exclude_non_seclabel_mounts();
 	atexit( done );
-	while ((opt = getopt(argc, argv, "df:uv")) > 0) {
+	while ((opt = getopt(argc, argv, "hdf:uv")) > 0) {
 		switch (opt) {
 		case 'd':
 			debug_mode = 1;
@@ -189,11 +188,16 @@ int main(int argc, char **argv)
 		case 'u':
 			run_as_user = 1;
 			break;
+		case 'h':
+			usage(argv[0]);
+			exit(0);
+			break;
 		case 'v':
 			r_opts.verbose++;
 			break;
 		case '?':
 			usage(argv[0]);
+			exit(-1);
 		}
 	}
 
-- 
1.7.9.3


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

  Powered by Linux