Blob Blame History Raw
From 629922b6dc32e4209980d7198b7d2aabb722033a Mon Sep 17 00:00:00 2001
From: Peter Jones <pjones@redhat.com>
Date: Mon, 15 Sep 2014 14:31:01 -0400
Subject: [PATCH 05/10] 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 118cb84..baf646b 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2119,8 +2119,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) {
-- 
1.9.3