Skip to content

Commit d99531e

Browse files
committed
battery-check: parse options before checking for kernel command line
Otherwise --help/--version/etc which exit immediately will do pointless work (cherry picked from commit 60d23b7) (cherry picked from commit 29cdad8) (cherry picked from commit 80e4e31) (cherry picked from commit 06b1c4b)
1 parent 01ba55b commit d99531e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/battery-check/battery-check.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,14 +153,14 @@ static int run(int argc, char *argv[]) {
153153

154154
log_setup();
155155

156-
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
157-
if (r < 0)
158-
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
159-
160156
r = parse_argv(argc, argv);
161157
if (r <= 0)
162158
return r;
163159

160+
r = proc_cmdline_parse(parse_proc_cmdline_item, NULL, PROC_CMDLINE_STRIP_RD_PREFIX);
161+
if (r < 0)
162+
log_warning_errno(r, "Failed to parse kernel command line, ignoring: %m");
163+
164164
if (!arg_doit) {
165165
log_info("Checking battery status and AC power existence is disabled by the kernel command line, skipping execution.");
166166
return 0;

0 commit comments

Comments
 (0)