mirror of
https://github.com/systemd/systemd.git
synced 2024-12-22 17:35:35 +03:00
battery-check: parse options before checking for kernel command line
Otherwise --help/--version/etc which exit immediately will do pointless work
This commit is contained in:
parent
1ca315be00
commit
60d23b7f4a
@ -123,14 +123,14 @@ static int run(int argc, char *argv[]) {
|
||||
|
||||
log_setup();
|
||||
|
||||
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
return r;
|
||||
|
||||
r = proc_cmdline_get_bool("systemd.battery_check", PROC_CMDLINE_STRIP_RD_PREFIX|PROC_CMDLINE_TRUE_WHEN_MISSING, &arg_doit);
|
||||
if (r < 0)
|
||||
log_warning_errno(r, "Failed to parse systemd.battery_check= kernel command line option, ignoring: %m");
|
||||
|
||||
if (!arg_doit) {
|
||||
log_info("Checking battery status and AC power existence is disabled by the kernel command line, skipping execution.");
|
||||
return 0;
|
||||
|
Loading…
Reference in New Issue
Block a user