[systemd-devel] [PATCH] analyze: fix seg-fault with no cl-argument

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Sat Jul 26 12:12:39 PDT 2014


On Thu, Jul 24, 2014 at 11:29:40PM +0200, Daniel Buch wrote:
> We need to check if argv[1] is set before compare
> ---
>  src/analyze/analyze.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/analyze/analyze.c b/src/analyze/analyze.c
> index 66e2aab..83da7f5 100644
> --- a/src/analyze/analyze.c
> +++ b/src/analyze/analyze.c
> @@ -1349,7 +1349,7 @@ int main(int argc, char *argv[]) {
>          if (r <= 0)
>                  goto finish;
>  
> -        if (streq(argv[optind], "verify"))
> +        if (argv[optind] && streq(argv[optind], "verify"))
>                  r = verify_units(argv+optind+1,
>                                   arg_user ? SYSTEMD_USER : SYSTEMD_SYSTEM,
>                                   arg_man);
Applied, with a change to use streq_ptr().

Zbyszek


More information about the systemd-devel mailing list