Blob Blame History Raw
From e990379f5c3c2a2ffe9b9e4a1afae0df0d8dcf80 Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 15 Sep 2014 14:31:01 -0400
Subject: [PATCH 21/41] Make findTemplate actually return the saved default.

Really not sure why this wasn't returning here before; going into the
loop below is just going to clobber all that it's done.

Related: rhbz#957681
Signed-off-by: Peter Jones <pjones@redhat.com>
---
 grubby.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/grubby.c b/grubby.c
index 4462fb9..6670ff0 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2114,8 +2114,12 @@ struct singleEntry * findTemplate(struct grubConfig * cfg, const char * prefix,
 		} else {
 		    entry = findEntryByTitle(cfg, defTitle, &index);
 		}
-		if (entry)
+		if (entry && suitableImage(entry, prefix, skipRemoved, flags)) {
 		    cfg->defaultImage = index;
+		    if (indexPtr)
+			*indexPtr = index;
+		    return entry;
+		}
 	    }
 	}
     } else if (cfg->defaultImage > -1) {
-- 
2.4.3