Blame SOURCES/0054-Ensure-command-line-updates-also-honor-set-index.patch

903092
From d4d7954a983f9cf68cd49c181e8deb1493e76e9e Mon Sep 17 00:00:00 2001
903092
From: Peter Jones <pjones@redhat.com>
903092
Date: Fri, 24 Jun 2016 16:05:45 -0400
903092
Subject: [PATCH 54/55] Ensure command line updates also honor --set-index
903092
903092
Related: rhbz#1285601
903092
903092
Signed-off-by: Peter Jones <pjones@redhat.com>
903092
---
903092
 grubby.c | 8 +++++++-
903092
 1 file changed, 7 insertions(+), 1 deletion(-)
903092
903092
diff --git a/grubby.c b/grubby.c
903092
index 2402116..c379388 100644
903092
--- a/grubby.c
903092
+++ b/grubby.c
903092
@@ -4292,11 +4292,17 @@ int addNewKernel(struct grubConfig *config, struct singleEntry *template,
903092
 	struct singleEntry *new, *entry, *prev = NULL;
903092
 	struct singleLine *newLine = NULL, *tmplLine = NULL, *masterLine = NULL;
903092
 	int needs;
903092
+	char *indexs;
903092
 	char *chptr;
903092
+	int rc;
903092
 
903092
 	if (!newKernelPath)
903092
 		return 0;
903092
 
903092
+	rc = asprintf(&indexs, "%d", newIndex);
903092
+	if (rc < 0)
903092
+		return 1;
903092
+
903092
 	/* if the newKernelTitle is too long silently munge it into something
903092
 	 * we can live with. truncating is first check, then we'll just mess with
903092
 	 * it until it looks better */
903092
@@ -4753,7 +4759,7 @@ int addNewKernel(struct grubConfig *config, struct singleEntry *template,
903092
 		abort();
903092
 	}
903092
 
903092
-	if (updateImage(config, "0", prefix, newKernelArgs, NULL,
903092
+	if (updateImage(config, indexs, prefix, newKernelArgs, NULL,
903092
 			newMBKernelArgs, NULL))
903092
 		return 1;
903092
 
903092
-- 
903092
2.5.5
903092