Re: [PATCH 1/4] dispol: add --help option

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

 



On Wed, Jun 7, 2023 at 9:59 PM Masatake YAMATO <yamato@xxxxxxxxxx> wrote:
>
> Signed-off-by: Masatake YAMATO <yamato@xxxxxxxxxx>

For these four patches:
Acked-by: James Carter <jwcart2@xxxxxxxxx>

Thanks,
Jim

> ---
>  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 b61f1b4b..50027e40 100644
> --- a/checkpolicy/test/dispol.c
> +++ b/checkpolicy/test/dispol.c
> @@ -38,7 +38,11 @@ static policydb_t policydb;
>
>  static __attribute__((__noreturn__)) void usage(const char *progname)
>  {
> -       printf("usage:  %s binary_pol_file\n\n", progname);
> +       puts("Usage:");
> +       printf(" %s [OPTIONS] binary_pol_file\n\n", progname);
> +       puts("Options:");
> +       puts(" -h, --help   print this help message");
> +       puts("\n");
>         exit(1);
>  }
>
> @@ -481,7 +485,7 @@ int main(int argc, char **argv)
>         int state;
>         struct policy_file pf;
>
> -       if (argc != 2)
> +       if (argc < 2 || strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)
>                 usage(argv[0]);
>
>         fd = open(argv[1], O_RDONLY);
> --
> 2.40.1
>




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

  Powered by Linux