From: Zbigniew Jędrzejewski-Szmek Date: Sat, 15 Jun 2019 14:37:55 +0000 (+0200) Subject: bootctl: fix display of options with embedeed newlines X-Git-Tag: v243~358^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9dae4c8a26d31d151cf1d09df6f8a21d34de8946;p=platform%2Fupstream%2Fsystemd.git 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.) --- diff --git a/src/boot/bootctl.c b/src/boot/bootctl.c index e7ba8b4..2f195f1 100644 --- a/src/boot/bootctl.c +++ b/src/boot/bootctl.c @@ -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);