|
Panu Matilainen |
e62cb2 |
From 911a4f253c7213a8570028a7dc2a20b045de8e9e Mon Sep 17 00:00:00 2001
|
|
Panu Matilainen |
e62cb2 |
Message-ID: <911a4f253c7213a8570028a7dc2a20b045de8e9e.1687934951.git.pmatilai@redhat.com>
|
|
Panu Matilainen |
e62cb2 |
From: Fabian Vogt <fvogt@suse.de>
|
|
Panu Matilainen |
e62cb2 |
Date: Mon, 26 Jun 2023 16:28:07 +0200
|
|
Panu Matilainen |
e62cb2 |
Subject: [PATCH] Actually return an error in parseScript if parsing fails
|
|
Panu Matilainen |
e62cb2 |
|
|
Panu Matilainen |
e62cb2 |
The return value is stored in the "res" variable which is set to the return
|
|
Panu Matilainen |
e62cb2 |
value of parseLines early in the function. Past that point, any "goto exit;"
|
|
Panu Matilainen |
e62cb2 |
caused the function to return success. This was introduced by 52ce88851abb
|
|
Panu Matilainen |
e62cb2 |
("Port parseScript() to use parseLines(), no functional changes"). To fix it,
|
|
Panu Matilainen |
e62cb2 |
reintroduce the nextPart variable.
|
|
Panu Matilainen |
e62cb2 |
---
|
|
Panu Matilainen |
e62cb2 |
build/parseScript.c | 6 ++++--
|
|
Panu Matilainen |
e62cb2 |
1 file changed, 4 insertions(+), 2 deletions(-)
|
|
Panu Matilainen |
e62cb2 |
|
|
Panu Matilainen |
e62cb2 |
diff --git a/build/parseScript.c b/build/parseScript.c
|
|
Panu Matilainen |
e62cb2 |
index f8b693ac6..6f3dc2fe8 100644
|
|
Panu Matilainen |
e62cb2 |
--- a/build/parseScript.c
|
|
Panu Matilainen |
e62cb2 |
+++ b/build/parseScript.c
|
|
Panu Matilainen |
e62cb2 |
@@ -95,7 +95,7 @@ int parseScript(rpmSpec spec, int parsePart)
|
|
Panu Matilainen |
e62cb2 |
int index;
|
|
Panu Matilainen |
e62cb2 |
char * reqargs = NULL;
|
|
Panu Matilainen |
e62cb2 |
|
|
Panu Matilainen |
e62cb2 |
- int res = PART_ERROR; /* assume failure */
|
|
Panu Matilainen |
e62cb2 |
+ int nextPart, res = PART_ERROR; /* assume failure */
|
|
Panu Matilainen |
e62cb2 |
int rc, argc;
|
|
Panu Matilainen |
e62cb2 |
int arg;
|
|
Panu Matilainen |
e62cb2 |
const char **argv = NULL;
|
|
Panu Matilainen |
e62cb2 |
@@ -367,7 +367,7 @@ int parseScript(rpmSpec spec, int parsePart)
|
|
Panu Matilainen |
e62cb2 |
goto exit;
|
|
Panu Matilainen |
e62cb2 |
}
|
|
Panu Matilainen |
e62cb2 |
|
|
Panu Matilainen |
e62cb2 |
- if ((res = parseLines(spec, STRIP_NOTHING, NULL, &sb)) == PART_ERROR)
|
|
Panu Matilainen |
e62cb2 |
+ if ((nextPart = parseLines(spec, STRIP_NOTHING, NULL, &sb)) == PART_ERROR)
|
|
Panu Matilainen |
e62cb2 |
goto exit;
|
|
Panu Matilainen |
e62cb2 |
|
|
Panu Matilainen |
e62cb2 |
if (sb) {
|
|
Panu Matilainen |
e62cb2 |
@@ -479,6 +479,8 @@ int parseScript(rpmSpec spec, int parsePart)
|
|
Panu Matilainen |
e62cb2 |
}
|
|
Panu Matilainen |
e62cb2 |
}
|
|
Panu Matilainen |
e62cb2 |
|
|
Panu Matilainen |
e62cb2 |
+ res = nextPart;
|
|
Panu Matilainen |
e62cb2 |
+
|
|
Panu Matilainen |
e62cb2 |
exit:
|
|
Panu Matilainen |
e62cb2 |
free(reqargs);
|
|
Panu Matilainen |
e62cb2 |
freeStringBuf(sb);
|
|
Panu Matilainen |
e62cb2 |
--
|
|
Panu Matilainen |
e62cb2 |
2.41.0
|
|
Panu Matilainen |
e62cb2 |
|