Blob Blame History Raw
From d472c20a5f6f4046d461c1148a29fba154b2e78b Mon Sep 17 00:00:00 2001
Message-Id: <d472c20a5f6f4046d461c1148a29fba154b2e78b.1566556207.git.pmatilai@redhat.com>
In-Reply-To: <ad4673589428db6e3b9fecd6f151eb899500336d.1566556207.git.pmatilai@redhat.com>
References: <ad4673589428db6e3b9fecd6f151eb899500336d.1566556207.git.pmatilai@redhat.com>
From: Panu Matilainen <pmatilai@redhat.com>
Date: Thu, 15 Aug 2019 14:45:31 +0300
Subject: [PATCH 3/3] Drop the no longer needed rpmfcExec() output duplication
 support

This effectively reverts commit 5fe8c9e6d55fe101c81399423a1e1b0f42882143,
but no functional changes as nothing was using this anymore.
---
 build/build.c             |  2 +-
 build/files.c             |  2 +-
 build/rpmbuild_internal.h |  3 +--
 build/rpmfc.c             | 14 ++++++--------
 4 files changed, 9 insertions(+), 12 deletions(-)

diff --git a/build/build.c b/build/build.c
index dc196090f..08c2df1e4 100644
--- a/build/build.c
+++ b/build/build.c
@@ -155,7 +155,7 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name,
 
     rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd);
     if (rpmfcExec((ARGV_const_t)argv, NULL, sb_stdoutp, 1,
-		  spec->buildSubdir, NULL)) {
+		  spec->buildSubdir)) {
 	rpmlog(RPMLOG_ERR, _("Bad exit status from %s (%s)\n"),
 		scriptName, name);
 	goto exit;
diff --git a/build/files.c b/build/files.c
index d54d67f38..ad4f462f1 100644
--- a/build/files.c
+++ b/build/files.c
@@ -2781,7 +2781,7 @@ static int checkFiles(const char *buildRoot, StringBuf fileList)
 
     rpmlog(RPMLOG_NOTICE, _("Checking for unpackaged file(s): %s\n"), s);
 
-    rc = rpmfcExec(av_ckfile, fileList, &sb_stdout, 0, buildRoot, NULL);
+    rc = rpmfcExec(av_ckfile, fileList, &sb_stdout, 0, buildRoot);
     if (rc < 0)
 	goto exit;
     
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
index 16d72ec9f..f3c8b5658 100644
--- a/build/rpmbuild_internal.h
+++ b/build/rpmbuild_internal.h
@@ -490,11 +490,10 @@ rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg);
  * @retval *sb_stdoutp	helper output
  * @param failnonzero	IS non-zero helper exit status a failure?
  * @param buildRoot	buildRoot directory (or NULL)
- * @param dup		duplicate output (or NULL)
  */
 RPM_GNUC_INTERNAL
 int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
-		int failnonzero, const char *buildRoot, FILE *dup);
+		int failnonzero, const char *buildRoot);
 
 /** \ingroup rpmbuild
  * Post-build processing for policies in binary package(s).
diff --git a/build/rpmfc.c b/build/rpmfc.c
index 94b4620d2..abfee8332 100644
--- a/build/rpmfc.c
+++ b/build/rpmfc.c
@@ -260,7 +260,7 @@ static rpmds rpmdsSingleNS(rpmstrPool pool,
 static int getOutputFrom(ARGV_t argv,
 			 const char * writePtr, size_t writeBytesLeft,
 			 StringBuf sb_stdout,
-			 int failNonZero, const char *buildRoot, FILE *dup)
+			 int failNonZero, const char *buildRoot)
 {
     pid_t child, reaped;
     int toProg[2] = { -1, -1 };
@@ -268,7 +268,7 @@ static int getOutputFrom(ARGV_t argv,
     int status;
     int myerrno = 0;
     int ret = 1; /* assume failure */
-    int doio = (writePtr || sb_stdout || dup);
+    int doio = (writePtr || sb_stdout);
 
     if (doio && (pipe(toProg) < 0 || pipe(fromProg) < 0)) {
 	rpmlog(RPMLOG_ERR, _("Couldn't create pipe for %s: %m\n"), argv[0]);
@@ -369,8 +369,6 @@ static int getOutputFrom(ARGV_t argv,
 	    buf[iorc] = '\0';
 	    if (sb_stdout)
 		appendStringBuf(sb_stdout, buf);
-	    if (dup)
-		fprintf(dup, "%s", buf);
 	}
     }
 
@@ -402,7 +400,7 @@ exit:
 }
 
 int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
-		int failnonzero, const char *buildRoot, FILE *dup)
+		int failnonzero, const char *buildRoot)
 {
     char * s = NULL;
     ARGV_t xav = NULL;
@@ -448,7 +446,7 @@ int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
 	sb = newStringBuf();
     }
     ec = getOutputFrom(xav, buf_stdin, buf_stdin_len, sb,
-		       failnonzero, buildRoot, dup);
+		       failnonzero, buildRoot);
     if (ec) {
 	sb = freeStringBuf(sb);
 	goto exit;
@@ -498,7 +496,7 @@ static ARGV_t runCmd(const char *cmd,
     argvAdd(&av, cmd);
 
     appendLineStringBuf(sb_stdin, fn);
-    if (rpmfcExec(av, sb_stdin, &sb_stdout, 0, buildRoot, NULL) == 0) {
+    if (rpmfcExec(av, sb_stdin, &sb_stdout, 0, buildRoot) == 0) {
 	argvSplit(&output, getStringBuf(sb_stdout), "\n\r");
     }
 
@@ -1359,7 +1357,7 @@ static rpmRC rpmfcApplyExternal(rpmfc fc)
 	free(s);
 
 	if (rpmfcExec(dm->argv, sb_stdin, &sb_stdout,
-			failnonzero, fc->buildRoot, NULL) == -1)
+			failnonzero, fc->buildRoot) == -1)
 	    continue;
 
 	if (sb_stdout == NULL) {
-- 
2.21.0