1
0
mirror of https://github.com/systemd/systemd.git synced 2024-12-23 21:35:11 +03:00

bootctl: fix display of options with embedeed newlines

I have an .efi image with embedded newlinews. Now I don't even remember if it
was created for testing or by accident, but it doesn't really matter. We should
display such files correctly.

(This isn't a problem with normal BLS entries, because input is split into lines
so newlines are consumed.)
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2019-06-15 16:37:55 +02:00 committed by Yu Watanabe
parent 44e891bbf6
commit 9dae4c8a26

View File

@ -25,6 +25,7 @@
#include "copy.h"
#include "dirent-util.h"
#include "efivars.h"
#include "escape.h"
#include "fd-util.h"
#include "fileio.h"
#include "fs-util.h"
@ -377,13 +378,24 @@ static int boot_entry_show(const BootEntry *e, bool show_as_default) {
*s,
&status);
if (!strv_isempty(e->options)) {
_cleanup_free_ char *t;
_cleanup_free_ char *t = NULL, *t2 = NULL;
_cleanup_strv_free_ char **ts = NULL;
t = strv_join(e->options, " ");
if (!t)
return log_oom();
printf(" options: %s\n", t);
ts = strv_split_newlines(t);
if (!ts)
return log_oom();
t2 = strv_join(ts, "\n ");
if (!t2)
return log_oom();
printf(" options: %s\n", t2);
}
if (e->device_tree)
boot_entry_file_list("devicetree", e->root, e->device_tree, &status);