1 Star 0 Fork 98

ridedolphin/grub2

forked from src-openEuler/grub2 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-kern-file-Fix-error-handling-in-grub_file_open.patch 1.32 KB
一键复制 编辑 原始数据 按行查看 历史
zhangqiumiao 提交于 2023-02-06 23:06 . backport some patches from upstream
From e375394fb9233fb1da13f7fb38e38d8aa83d1443 Mon Sep 17 00:00:00 2001
From: Steve McIntyre <steve@einval.com>
Date: Tue, 6 Dec 2022 01:45:11 +0000
Subject: kern/file: Fix error handling in grub_file_open()
grub_file_open() calls grub_file_get_device_name(), but doesn't check
the return. Instead, it checks if grub_errno is set.
However, nothing initialises grub_errno here when grub_file_open()
starts. This means that trying to open one file that doesn't exist and
then trying to open another file that does will (incorrectly) also
fail to open that second file.
Let's fix that.
Reference:https://git.savannah.gnu.org/cgit/grub.git/commit?id=e375394fb9233fb1da13f7fb38e38d8aa83d1443
Conflict:NA
Signed-off-by: Steve McIntyre <steve@einval.com>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
---
grub-core/kern/file.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/grub-core/kern/file.c b/grub-core/kern/file.c
index ed69fc0..70b3c62 100644
--- a/grub-core/kern/file.c
+++ b/grub-core/kern/file.c
@@ -66,6 +66,9 @@ grub_file_open (const char *name, enum grub_file_type type)
const char *file_name;
grub_file_filter_id_t filter;
+ /* Reset grub_errno before we start. */
+ grub_errno = GRUB_ERR_NONE;
+
grub_dprintf ("file", "Opening `%s' ...\n", name);
device_name = grub_file_get_device_name (name);
--
2.19.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/ridedolphin/grub2.git
git@gitee.com:ridedolphin/grub2.git
ridedolphin
grub2
grub2
master

搜索帮助