]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
efi: Skip parsing SystemdOptions if there's an error getting it.
authorFilipe Brandenburger <filbranden@gmail.com>
Thu, 11 Jun 2020 22:33:32 +0000 (15:33 -0700)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 14 Jun 2020 08:51:01 +0000 (10:51 +0200)
The original logic was logging an "ignored" debug message, but it was still
going ahead and calling proc_cmdline_parse_given() on the NULL line. Fix that
to skip that explicitly when the EFI variable wasn't really read.

src/basic/proc-cmdline.c

index eb45682f3a4a6cdaf10422649cc5e75f552d73ab..ba47ca5812bd9b884375f1f09e343721cd01823f 100644 (file)
@@ -121,14 +121,16 @@ int proc_cmdline_parse(proc_cmdline_parse_t parse_item, void *data, ProcCmdlineF
 
         if (!FLAGS_SET(flags, PROC_CMDLINE_IGNORE_EFI_OPTIONS)) {
                 r = systemd_efi_options_variable(&line);
-                if (r < 0 && r != -ENODATA)
-                        log_debug_errno(r, "Failed to get SystemdOptions EFI variable, ignoring: %m");
-
-                r = proc_cmdline_parse_given(line, parse_item, data, flags);
-                if (r < 0)
-                        return r;
+                if (r < 0) {
+                        if (r != -ENODATA)
+                                log_debug_errno(r, "Failed to get SystemdOptions EFI variable, ignoring: %m");
+                } else {
+                        r = proc_cmdline_parse_given(line, parse_item, data, flags);
+                        if (r < 0)
+                                return r;
 
-                line = mfree(line);
+                        line = mfree(line);
+                }
         }
 
         r = proc_cmdline(&line);