8 Star 0 Fork 11

src-anolis-os/grubby

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
0038-Write-correct-default-to-environment-1285601.patch 1.29 KB
一键复制 编辑 原始数据 按行查看 历史
张彬琛 提交于 2021-01-20 13:34 . import grubby-8.40-38.el8.src.rpm
From d3c64808b6fc4794e2c58b1812315914966afea9 Mon Sep 17 00:00:00 2001
From: Robert Marshall <rmarshall@redhat.com>
Date: Thu, 22 Dec 2016 17:56:44 -0500
Subject: [PATCH 38/55] Write correct default to environment (#1285601)
grubby writes the title of the default boot entry to the bootloader
environment. The title lookup did not correctly account for the offset
required if some boot entries were marked for removal.
Related: rhbz#1285601
---
grubby.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/grubby.c b/grubby.c
index 692c351ccb6..9edb26d0ded 100644
--- a/grubby.c
+++ b/grubby.c
@@ -1709,7 +1709,20 @@ static void writeDefault(FILE * out, char *indent,
fprintf(out, "%sset default=\"${saved_entry}\"\n", indent);
if (cfg->defaultImage >= FIRST_ENTRY_INDEX && cfg->cfi->setEnv) {
char *title;
- entry = findEntryByIndex(cfg, cfg->defaultImage);
+ int trueIndex, currentIndex;
+
+ trueIndex = 0;
+ currentIndex = 0;
+
+ while ((entry = findEntryByIndex(cfg, currentIndex))) {
+ if (!entry->skip) {
+ if (trueIndex == cfg->defaultImage) {
+ break;
+ }
+ trueIndex++;
+ }
+ currentIndex++;
+ }
line = getLineByType(LT_MENUENTRY, entry->lines);
if (!line)
line = getLineByType(LT_TITLE, entry->lines);
--
2.17.1
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/grubby.git
git@gitee.com:src-anolis-os/grubby.git
src-anolis-os
grubby
grubby
a8

搜索帮助