On 10/8/19 2:44 AM, Masatake YAMATO wrote:
Signed-off-by: Masatake YAMATO <yamato@xxxxxxxxxx>
---
checkpolicy/test/dispol.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/checkpolicy/test/dispol.c b/checkpolicy/test/dispol.c
index 1d9556f4..37b22cf8 100644
--- a/checkpolicy/test/dispol.c
+++ b/checkpolicy/test/dispol.c
@@ -39,7 +39,7 @@ static policydb_t policydb;
static __attribute__((__noreturn__)) void usage(const char *progname,
int status)
{
- printf("usage: %s binary_pol_file\n\n", progname);
+ printf("usage: %s [-h] binary_pol_file\n\n", progname);
exit(status);
}
@@ -395,7 +395,11 @@ int main(int argc, char **argv)
int state;
struct policy_file pf;
- if (argc != 2)
+ if (argc <= 1)
+ usage(argv[0], 1);
+ else if (strcmp(argv[1], "-h") == 0)
+ usage(argv[0], 0);
+ else if (argc != 2)
usage(argv[0], 1);
Use getopt(3) or getopt_long(3) please for option handling.
fd = open(argv[1], O_RDONLY);