diff mbox series

[1/5] dispol: extend usage() to take error code as an argument

Message ID 20191008064500.8651-2-yamato@redhat.com (mailing list archive)
State Changes Requested
Headers show
Series dispol: add batch execution mode | expand

Commit Message

Masatake YAMATO Oct. 8, 2019, 6:44 a.m. UTC
This allows dispol command to exit successfully after
printing help messages.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
---
 checkpolicy/test/dispol.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/checkpolicy/test/dispol.c b/checkpolicy/test/dispol.c
index d72d9fb3..1d9556f4 100644
--- a/checkpolicy/test/dispol.c
+++ b/checkpolicy/test/dispol.c
@@ -36,10 +36,11 @@ 
 
 static policydb_t policydb;
 
-static __attribute__((__noreturn__)) void usage(const char *progname)
+static __attribute__((__noreturn__)) void usage(const char *progname,
+						int status)
 {
 	printf("usage:  %s binary_pol_file\n\n", progname);
-	exit(1);
+	exit(status);
 }
 
 int render_access_mask(uint32_t mask, avtab_key_t * key, policydb_t * p,
@@ -395,7 +396,7 @@  int main(int argc, char **argv)
 	struct policy_file pf;
 
 	if (argc != 2)
-		usage(argv[0]);
+		usage(argv[0], 1);
 
 	fd = open(argv[1], O_RDONLY);
 	if (fd < 0) {