diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-05-20 19:18:45 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-05-20 19:18:45 +0200 |
commit | 05a7827e8782527f6c28d5f3f1fbec327b141754 (patch) | |
tree | 1fc623f8bcf345f1c66a7167f76b4447169c2632 /src/basic/proc-cmdline.c | |
parent | 4b5ee5901caa4cecefd333462660956d67ed2975 (diff) | |
download | systemd-05a7827e8782527f6c28d5f3f1fbec327b141754.tar.gz |
proc-cmdline: add checking of EFI options variable in proc_cmdline_get_key_many() too
Diffstat (limited to 'src/basic/proc-cmdline.c')
-rw-r--r-- | src/basic/proc-cmdline.c | 23 |
1 files changed, 19 insertions, 4 deletions
diff --git a/src/basic/proc-cmdline.c b/src/basic/proc-cmdline.c index 1bc884c20d..5545543fbd 100644 --- a/src/basic/proc-cmdline.c +++ b/src/basic/proc-cmdline.c @@ -296,6 +296,7 @@ int proc_cmdline_get_bool(const char *key, bool *ret) { int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...) { _cleanup_free_ char *line = NULL; + bool processing_efi = true; const char *p; va_list ap; int r, ret = 0; @@ -306,9 +307,9 @@ int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...) { /* This call may clobber arguments on failure! */ - r = proc_cmdline(&line); - if (r < 0) - return r; + r = systemd_efi_options_variable(&line); + if (r < 0 && r != -ENODATA) + log_debug_errno(r, "Failed to get SystemdOptions EFI variable, ignoring: %m"); p = line; for (;;) { @@ -317,8 +318,22 @@ int proc_cmdline_get_key_many_internal(ProcCmdlineFlags flags, ...) { r = proc_cmdline_extract_first(&p, &word, flags); if (r < 0) return r; - if (r == 0) + if (r == 0) { + /* We finished with this command line. If this was the EFI one, then let's proceed with the regular one */ + if (processing_efi) { + processing_efi = false; + + line = mfree(line); + r = proc_cmdline(&line); + if (r < 0) + return r; + + p = line; + continue; + } + break; + } va_start(ap, flags); |