From: Filipe Brandenburger Date: Thu, 11 Jun 2020 22:33:32 +0000 (-0700) Subject: efi: Skip parsing SystemdOptions if there's an error getting it. X-Git-Tag: v246-rc1~152 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7283fbfd0c46819fea9f0a20671eaef99b3993e5;p=thirdparty%2Fsystemd.git efi: Skip parsing SystemdOptions if there's an error getting it. 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. --- diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index eb45682f3a4..ba47ca5812b 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -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);