1 Star 0 Fork 80

houlifei/rpm

forked from src-openEuler/rpm 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
backport-Actually-return-an-error-in-parseScript-if-parsing-f.patch 1.47 KB
一键复制 编辑 原始数据 按行查看 历史
renxichen 提交于 2023-08-02 16:25 . backport some patches from upstream
From 911a4f253c7213a8570028a7dc2a20b045de8e9e Mon Sep 17 00:00:00 2001
From: Fabian Vogt <fvogt@suse.de>
Date: Mon, 26 Jun 2023 16:28:07 +0200
Subject: [PATCH] Actually return an error in parseScript if parsing fails
The return value is stored in the "res" variable which is set to the return
value of parseLines early in the function. Past that point, any "goto exit;"
caused the function to return success. This was introduced by 52ce88851abb
("Port parseScript() to use parseLines(), no functional changes"). To fix it,
reintroduce the nextPart variable.
---
build/parseScript.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/build/parseScript.c b/build/parseScript.c
index f8b693ac6..6f3dc2fe8 100644
--- a/build/parseScript.c
+++ b/build/parseScript.c
@@ -95,7 +95,7 @@ int parseScript(rpmSpec spec, int parsePart)
int index;
char * reqargs = NULL;
- int res = PART_ERROR; /* assume failure */
+ int nextPart, res = PART_ERROR; /* assume failure */
int rc, argc;
int arg;
const char **argv = NULL;
@@ -367,7 +367,7 @@ int parseScript(rpmSpec spec, int parsePart)
goto exit;
}
- if ((res = parseLines(spec, STRIP_NOTHING, NULL, &sb)) == PART_ERROR)
+ if ((nextPart = parseLines(spec, STRIP_NOTHING, NULL, &sb)) == PART_ERROR)
goto exit;
if (sb) {
@@ -479,6 +479,8 @@ int parseScript(rpmSpec spec, int parsePart)
}
}
+ res = nextPart;
+
exit:
free(reqargs);
freeStringBuf(sb);
--
2.27.0
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/houlifei_uniontech/rpm.git
git@gitee.com:houlifei_uniontech/rpm.git
houlifei_uniontech
rpm
rpm
master

搜索帮助