From b61c061bef9fc184bb159aca7d6a788e24233432 Mon Sep 17 00:00:00 2001 From: Carlo Teubner Date: Sat, 25 May 2024 13:07:28 +0100 Subject: [PATCH] efibootmgr: print space before optional entry data MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Before: $ efibootmgr -u […] Boot0004* Arch Linux HD(1,GPT,[…],0x800,0x145000)/\vmlinuz-linuxroot=LABEL=Arch rw nowatchdog initrd=\initramfs-linux.img After: $ efibootmgr -u […] Boot0004* Arch Linux HD(1,GPT,[…],0x800,0x145000)/\vmlinuz-linux root=LABEL=Arch rw nowatchdog initrd=\initramfs-linux.img Note the extra space before "root=". Signed-off-by: Carlo Teubner --- src/efibootmgr.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/efibootmgr.c b/src/efibootmgr.c index 0094e05..53c5dd8 100644 --- a/src/efibootmgr.c +++ b/src/efibootmgr.c @@ -1035,7 +1035,7 @@ show_var_path(efi_load_option *load_option, size_t boot_data_size) warning("Could not parse optional data"); return; } - text_path = calloc(1, sizeof(" File(.") + text_path = calloc(1, sizeof("File(.") + strlen(a) + strlen(")")); if (!text_path) { @@ -1045,7 +1045,7 @@ show_var_path(efi_load_option *load_option, size_t boot_data_size) } char *b; - b = stpcpy(text_path, " File(."); + b = stpcpy(text_path, "File(."); b = stpcpy(b, a); stpcpy(b, ")"); free(a); @@ -1083,6 +1083,8 @@ show_var_path(efi_load_option *load_option, size_t boot_data_size) return; } } + if (strlen(text_path) > 0) + printf(" "); printf("%s", text_path); free(text_path); printf("\n");