summaryrefslogtreecommitdiff
path: root/backport-Fix-some-int-enum-confusion-in-the-build-code.patch
blob: 0583b6d7d3e728c3a0b1ffaeb92f6645b64f6949 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From f2eb6fa6ba77fbf5f62add8a01544cce8c0beb6b Mon Sep 17 00:00:00 2001
From: Panu Matilainen <pmatilai@redhat.com>
Date: Fri, 15 Mar 2024 16:41:28 +0200
Subject: [PATCH] Fix some int/enum confusion in the build code

These things are not really returning rpmRC values, especially as they
need to pass around RPMRC_MISSINGBUILDREQUIRES which is not part of the
enum.

For doRmSource(), 0 and 1 aren't any more enums values than 0 and -1 are,
and besides, the sole caller isn't even checking the return code.

Conflict:NA
Reference:https://github.com/rpm-software-management/rpm/commit/f2eb6fa6ba77fbf5f62add8a01544cce8c0beb6b

---
 build/build.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/build/build.c b/build/build.c
index 8e6c8f842..69ab69fc9 100644
--- a/build/build.c
+++ b/build/build.c
@@ -78,7 +78,7 @@ static char * buildHost(void)
 
 /**
  */
-static rpmRC doRmSource(rpmSpec spec)
+static int doRmSource(rpmSpec spec)
 {
     struct Source *p;
     Package pkg;
@@ -100,7 +100,7 @@ static rpmRC doRmSource(rpmSpec spec)
 	}
     }
 exit:
-    return !rc ? 0 : 1;
+    return rc;
 }
 
 /*
@@ -290,9 +290,9 @@ static int doBuildRequires(rpmSpec spec, int test)
     return rc;
 }
 
-static rpmRC doCheckBuildRequires(rpmts ts, rpmSpec spec, int test)
+static int doCheckBuildRequires(rpmts ts, rpmSpec spec, int test)
 {
-    rpmRC rc = RPMRC_OK;
+    int rc = RPMRC_OK;
     rpmps ps = rpmSpecCheckDeps(ts, spec);
 
     if (ps) {
@@ -323,9 +323,9 @@ static rpmRC doBuildDir(rpmSpec spec, int test, StringBuf *sbp)
     return rc;
 }
 
-static rpmRC buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
+static int buildSpec(rpmts ts, BTA_t buildArgs, rpmSpec spec, int what)
 {
-    rpmRC rc = RPMRC_OK;
+    int rc = RPMRC_OK;
     int missing_buildreqs = 0;
     int test = (what & RPMBUILD_NOBUILD);
     char *cookie = buildArgs->cookie ? xstrdup(buildArgs->cookie) : NULL;
-- 
2.33.0