Blob Blame History Raw
From 8d81aeffcb1c2f9706dfe625a2f9f5e61f8a5c63 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Tue, 14 Mar 2017 15:20:53 -0400
Subject: [PATCH 42/55] Fix --info for s390x/s390 (#1285601)

The --info flag for grubby on s390/s390x always returned (null). Fixed
codepath to use extractTitle where necessary and get the actual title.

Related: rhbz#1285601
---
 grubby.c | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/grubby.c b/grubby.c
index 974b81c7864..9bf051dfed4 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2684,7 +2684,7 @@ void setFallbackImage(struct grubConfig *config, int hasNew)
 	}
 }
 
-void displayEntry(struct singleEntry *entry, const char *prefix, int index)
+void displayEntry(struct grubConfig *config, struct singleEntry *entry, const char *prefix, int index)
 {
 	struct singleLine *line;
 	char *root = NULL;
@@ -2780,7 +2780,14 @@ void displayEntry(struct singleEntry *entry, const char *prefix, int index)
 
 	line = getLineByType(LT_TITLE, entry->lines);
 	if (line) {
-		printf("title=%s\n", line->elements[1].item);
+                char *entryTitle;
+                /* if we can extractTitle, then it's a zipl config and
+                 * if not then we go ahead with what's existed prior */
+                entryTitle = extractTitle(config, line);
+                if (!entryTitle) {
+                    entryTitle=line->elements[1].item;
+                }
+		printf("title=%s\n", entryTitle);
 	} else {
 		char *title;
 		line = getLineByType(LT_MENUENTRY, entry->lines);
@@ -3196,11 +3203,11 @@ int displayInfo(struct grubConfig *config, char *kernel, const char *prefix)
 			printf("lba\n");
 	}
 
-	displayEntry(entry, prefix, i);
+	displayEntry(config, entry, prefix, i);
 
 	i++;
 	while ((entry = findEntryByPath(config, kernel, prefix, &i))) {
-		displayEntry(entry, prefix, i);
+		displayEntry(config, entry, prefix, i);
 		i++;
 	}
 
-- 
2.17.1