[systemd-devel] [PATCH] systemd-verify: call help() and exit if no CL-argument

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Jul 21 12:31:00 PDT 2014


On Mon, Jul 21, 2014 at 08:04:33PM +0200, Daniel Buch wrote:
> Im not sure if we want the help approach or just fail?
> 
> I can change this and resed if you want.
> 
> Assertion 'strv_uniq(ans)' failed at src/verify/verify.c:53, function generate_path(). Aborting.
> [1]    4795 abort (core dumped)  systemd-verify
Hm, it was supposed to do nothing in that case.

But Lennart wants it the code merged with systemd-analyze (or systemctl).
I'll add a check when doing that.

> -        int c;
> +        int c, left;
>  
>          assert(argc >= 1);
>          assert(argv);
>  
>          opterr = 0;
>  
> +        left = argc - optind;
> +
> +        if (left <= 0) {
> +                help();
> +                return -EINVAL;
> +        }
(I really hate the "print help on error" approach, because it usually
obscures the error. In addition, help() prints to stdout, which is
wrong.)

Zbyszek


More information about the systemd-devel mailing list