systemctl: use argv[0] not program_invocation_short_name for arg dispatch
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 15 Feb 2021 08:54:14 +0000 (09:54 +0100)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 15 Feb 2021 09:00:08 +0000 (10:00 +0100)
commitd41a9e4fc1e1bcdefc8d358da2744a97aac5820a
treeed5db930bbbd3d1ea00828674ceb4c27cad4dd9a
parentc39e36203ff79a831c93dfb9380c967cd7fdbb99
systemctl: use argv[0] not program_invocation_short_name for arg dispatch

The immediate motivation is to allow fuzz-systemctl-parse-argv to cover also
the other code paths. p_i_s_n is not getting set (and it probably shouldn't),
so the fuzzer would only cover the paths for ./systemctl, and not ./reboot,
etc. Looking at argv[0] instead, which is passed as part of the fuzzer data,
fixes that.

But I think in general it's more correct to look at argv[0] here: after all we
have all the information available through local variables and shouldn't go out
of our way to look at a global.
src/systemctl/systemctl.c