File fwupdate-bsc988886-add-leading-space.patch of Package fwupdate.24672

From ee6651647de531db051fc1013b31f7541d315dfc Mon Sep 17 00:00:00 2001
From: Gary Lin <glin@suse.com>
Date: Fri, 15 Jul 2016 10:57:46 +0800
Subject: [PATCH] Prepend "space" to the load option

When using shim as the first stage loader, merely the path to fwup*.efi
is not enough since shim will ignore the string before the first ' '.
This commit prepends ' ' to the path to make shim load fwup*.efi.

Signed-off-by: Gary Lin <glin@suse.com>
---
 linux/libfwup.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/linux/libfwup.c b/linux/libfwup.c
index bae1e63..a94f8d6 100644
--- a/linux/libfwup.c
+++ b/linux/libfwup.c
@@ -665,6 +665,7 @@ set_up_boot_next(void)
 	char *shim_fs_path = NULL;
 	char *fwup_fs_path = NULL;
 	char *fwup_esp_path = NULL;
+	char *fwup_option = NULL;
 	int use_fwup_path = 0;
 
 	char *label = NULL;
@@ -690,7 +691,10 @@ set_up_boot_next(void)
 		goto out;
 
 	if (!use_fwup_path) {
-		loader_str = utf8_to_ucs2((uint8_t *)fwup_esp_path, -1);
+		fwup_option = alloca(strlen(fwup_esp_path) + 2);
+		fwup_option[0] = ' ';
+		strcpy(fwup_option + 1, fwup_esp_path);
+		loader_str = utf8_to_ucs2((uint8_t *)fwup_option, -1);
 		loader_sz = ucs2len(loader_str, -1) * 2;
 		if (loader_sz)
 			loader_sz += 2;
-- 
2.9.0

openSUSE Build Service is sponsored by