From 12ae8096bd3099b81fded8c30be1a8050ed7e68c Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Thu, 8 Dec 2016 16:52:45 -0500
Subject: [PATCH 32/55] Track configuration modifications
The setDefaultImage function had a subtle dependency on being run before
addNewKernel is invoked. Added the ability to track invocation to
prevent them from being so tightly coupled.
Related: rhbz#1285601
---
grubby.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/grubby.c b/grubby.c
index a717c18999b..1f712ec1391 100644
--- a/grubby.c
+++ b/grubby.c
@@ -678,6 +678,8 @@ struct grubConfig {
int fallbackImage; /* just like defaultImage */
int flags;
struct configFileInfo *cfi;
+ int isModified; /* assumes only one entry added
+ per invocation of grubby */
};
blkid_cache blkid;
@@ -1297,6 +1299,7 @@ static struct grubConfig *readConfig(const char *inName,
cfg->theLines = NULL;
cfg->entries = NULL;
cfg->fallbackImage = 0;
+ cfg->isModified = 0;
/* copy everything we have */
while (*head) {
@@ -4726,8 +4729,10 @@ int addNewKernel(struct grubConfig *config, struct singleEntry *template,
}
if (updateImage(config, indexs, prefix, newKernelArgs, NULL,
- newMBKernelArgs, NULL))
+ newMBKernelArgs, NULL)) {
+ config->isModified = 1;
return 1;
+ }
return 0;
}
--
2.17.1