加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Fix-maybe-uninitialized-warning.patch 1.08 KB
一键复制 编辑 原始数据 按行查看 历史
杨壮壮 提交于 2021-07-30 14:22 . fix build failed with gcc 10
From 99d10a31cee89eb45ac0743f484018d36500ce66 Mon Sep 17 00:00:00 2001
From: Javier Martinez Canillas <javierm@redhat.com>
Date: Mon, 10 Feb 2020 20:08:42 +0100
Subject: [PATCH] Fix maybe-uninitialized warning
GCC gives the following compile warning:
grubby.c: In function 'suseGrubConfGetBoot':
grubby.c:2770:5: error: 'grubDevice' may be used uninitialized in this function [-Werror=maybe-uninitialized]
2770 | free(grubDevice);
| ^~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make: *** [Makefile:38: grubby.o] Error 1
Signed-off-by: Javier Martinez Canillas <javierm@redhat.com>
---
grubby.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/grubby.c b/grubby.c
index 5de935d..74befea 100644
--- a/grubby.c
+++ b/grubby.c
@@ -2896,7 +2896,7 @@ int grubGetBootFromDeviceMap(const char * device,
}
int suseGrubConfGetBoot(const char * path, char ** bootPtr) {
- char * grubDevice;
+ char * grubDevice = NULL;
if (suseGrubConfGetInstallDevice(path, &grubDevice))
dbgPrintf("error looking for grub installation device\n");
--
1.8.3.1
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化