Panu Matilainen c9c421
From d472c20a5f6f4046d461c1148a29fba154b2e78b Mon Sep 17 00:00:00 2001
Panu Matilainen c9c421
Message-Id: <d472c20a5f6f4046d461c1148a29fba154b2e78b.1566556207.git.pmatilai@redhat.com>
Panu Matilainen c9c421
In-Reply-To: <ad4673589428db6e3b9fecd6f151eb899500336d.1566556207.git.pmatilai@redhat.com>
Panu Matilainen c9c421
References: <ad4673589428db6e3b9fecd6f151eb899500336d.1566556207.git.pmatilai@redhat.com>
Panu Matilainen c9c421
From: Panu Matilainen <pmatilai@redhat.com>
Panu Matilainen c9c421
Date: Thu, 15 Aug 2019 14:45:31 +0300
Panu Matilainen c9c421
Subject: [PATCH 3/3] Drop the no longer needed rpmfcExec() output duplication
Panu Matilainen c9c421
 support
Panu Matilainen c9c421
Panu Matilainen c9c421
This effectively reverts commit 5fe8c9e6d55fe101c81399423a1e1b0f42882143,
Panu Matilainen c9c421
but no functional changes as nothing was using this anymore.
Panu Matilainen c9c421
---
Panu Matilainen c9c421
 build/build.c             |  2 +-
Panu Matilainen c9c421
 build/files.c             |  2 +-
Panu Matilainen c9c421
 build/rpmbuild_internal.h |  3 +--
Panu Matilainen c9c421
 build/rpmfc.c             | 14 ++++++--------
Panu Matilainen c9c421
 4 files changed, 9 insertions(+), 12 deletions(-)
Panu Matilainen c9c421
Panu Matilainen c9c421
diff --git a/build/build.c b/build/build.c
Panu Matilainen c9c421
index dc196090f..08c2df1e4 100644
Panu Matilainen c9c421
--- a/build/build.c
Panu Matilainen c9c421
+++ b/build/build.c
Panu Matilainen c9c421
@@ -155,7 +155,7 @@ rpmRC doScript(rpmSpec spec, rpmBuildFlags what, const char *name,
Panu Matilainen c9c421
 
Panu Matilainen c9c421
     rpmlog(RPMLOG_NOTICE, _("Executing(%s): %s\n"), name, buildCmd);
Panu Matilainen c9c421
     if (rpmfcExec((ARGV_const_t)argv, NULL, sb_stdoutp, 1,
Panu Matilainen c9c421
-		  spec->buildSubdir, NULL)) {
Panu Matilainen c9c421
+		  spec->buildSubdir)) {
Panu Matilainen c9c421
 	rpmlog(RPMLOG_ERR, _("Bad exit status from %s (%s)\n"),
Panu Matilainen c9c421
 		scriptName, name);
Panu Matilainen c9c421
 	goto exit;
Panu Matilainen c9c421
diff --git a/build/files.c b/build/files.c
Panu Matilainen c9c421
index d54d67f38..ad4f462f1 100644
Panu Matilainen c9c421
--- a/build/files.c
Panu Matilainen c9c421
+++ b/build/files.c
Panu Matilainen c9c421
@@ -2781,7 +2781,7 @@ static int checkFiles(const char *buildRoot, StringBuf fileList)
Panu Matilainen c9c421
 
Panu Matilainen c9c421
     rpmlog(RPMLOG_NOTICE, _("Checking for unpackaged file(s): %s\n"), s);
Panu Matilainen c9c421
 
Panu Matilainen c9c421
-    rc = rpmfcExec(av_ckfile, fileList, &sb_stdout, 0, buildRoot, NULL);
Panu Matilainen c9c421
+    rc = rpmfcExec(av_ckfile, fileList, &sb_stdout, 0, buildRoot);
Panu Matilainen c9c421
     if (rc < 0)
Panu Matilainen c9c421
 	goto exit;
Panu Matilainen c9c421
     
Panu Matilainen c9c421
diff --git a/build/rpmbuild_internal.h b/build/rpmbuild_internal.h
Panu Matilainen c9c421
index 16d72ec9f..f3c8b5658 100644
Panu Matilainen c9c421
--- a/build/rpmbuild_internal.h
Panu Matilainen c9c421
+++ b/build/rpmbuild_internal.h
Panu Matilainen c9c421
@@ -490,11 +490,10 @@ rpmRC rpmfcGenerateDepends(const rpmSpec spec, Package pkg);
Panu Matilainen c9c421
  * @retval *sb_stdoutp	helper output
Panu Matilainen c9c421
  * @param failnonzero	IS non-zero helper exit status a failure?
Panu Matilainen c9c421
  * @param buildRoot	buildRoot directory (or NULL)
Panu Matilainen c9c421
- * @param dup		duplicate output (or NULL)
Panu Matilainen c9c421
  */
Panu Matilainen c9c421
 RPM_GNUC_INTERNAL
Panu Matilainen c9c421
 int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
Panu Matilainen c9c421
-		int failnonzero, const char *buildRoot, FILE *dup);
Panu Matilainen c9c421
+		int failnonzero, const char *buildRoot);
Panu Matilainen c9c421
 
Panu Matilainen c9c421
 /** \ingroup rpmbuild
Panu Matilainen c9c421
  * Post-build processing for policies in binary package(s).
Panu Matilainen c9c421
diff --git a/build/rpmfc.c b/build/rpmfc.c
Panu Matilainen c9c421
index 94b4620d2..abfee8332 100644
Panu Matilainen c9c421
--- a/build/rpmfc.c
Panu Matilainen c9c421
+++ b/build/rpmfc.c
Panu Matilainen c9c421
@@ -260,7 +260,7 @@ static rpmds rpmdsSingleNS(rpmstrPool pool,
Panu Matilainen c9c421
 static int getOutputFrom(ARGV_t argv,
Panu Matilainen c9c421
 			 const char * writePtr, size_t writeBytesLeft,
Panu Matilainen c9c421
 			 StringBuf sb_stdout,
Panu Matilainen c9c421
-			 int failNonZero, const char *buildRoot, FILE *dup)
Panu Matilainen c9c421
+			 int failNonZero, const char *buildRoot)
Panu Matilainen c9c421
 {
Panu Matilainen c9c421
     pid_t child, reaped;
Panu Matilainen c9c421
     int toProg[2] = { -1, -1 };
Panu Matilainen c9c421
@@ -268,7 +268,7 @@ static int getOutputFrom(ARGV_t argv,
Panu Matilainen c9c421
     int status;
Panu Matilainen c9c421
     int myerrno = 0;
Panu Matilainen c9c421
     int ret = 1; /* assume failure */
Panu Matilainen c9c421
-    int doio = (writePtr || sb_stdout || dup);
Panu Matilainen c9c421
+    int doio = (writePtr || sb_stdout);
Panu Matilainen c9c421
 
Panu Matilainen c9c421
     if (doio && (pipe(toProg) < 0 || pipe(fromProg) < 0)) {
Panu Matilainen c9c421
 	rpmlog(RPMLOG_ERR, _("Couldn't create pipe for %s: %m\n"), argv[0]);
Panu Matilainen c9c421
@@ -369,8 +369,6 @@ static int getOutputFrom(ARGV_t argv,
Panu Matilainen c9c421
 	    buf[iorc] = '\0';
Panu Matilainen c9c421
 	    if (sb_stdout)
Panu Matilainen c9c421
 		appendStringBuf(sb_stdout, buf);
Panu Matilainen c9c421
-	    if (dup)
Panu Matilainen c9c421
-		fprintf(dup, "%s", buf);
Panu Matilainen c9c421
 	}
Panu Matilainen c9c421
     }
Panu Matilainen c9c421
 
Panu Matilainen c9c421
@@ -402,7 +400,7 @@ exit:
Panu Matilainen c9c421
 }
Panu Matilainen c9c421
 
Panu Matilainen c9c421
 int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
Panu Matilainen c9c421
-		int failnonzero, const char *buildRoot, FILE *dup)
Panu Matilainen c9c421
+		int failnonzero, const char *buildRoot)
Panu Matilainen c9c421
 {
Panu Matilainen c9c421
     char * s = NULL;
Panu Matilainen c9c421
     ARGV_t xav = NULL;
Panu Matilainen c9c421
@@ -448,7 +446,7 @@ int rpmfcExec(ARGV_const_t av, StringBuf sb_stdin, StringBuf * sb_stdoutp,
Panu Matilainen c9c421
 	sb = newStringBuf();
Panu Matilainen c9c421
     }
Panu Matilainen c9c421
     ec = getOutputFrom(xav, buf_stdin, buf_stdin_len, sb,
Panu Matilainen c9c421
-		       failnonzero, buildRoot, dup);
Panu Matilainen c9c421
+		       failnonzero, buildRoot);
Panu Matilainen c9c421
     if (ec) {
Panu Matilainen c9c421
 	sb = freeStringBuf(sb);
Panu Matilainen c9c421
 	goto exit;
Panu Matilainen c9c421
@@ -498,7 +496,7 @@ static ARGV_t runCmd(const char *cmd,
Panu Matilainen c9c421
     argvAdd(&av, cmd);
Panu Matilainen c9c421
 
Panu Matilainen c9c421
     appendLineStringBuf(sb_stdin, fn);
Panu Matilainen c9c421
-    if (rpmfcExec(av, sb_stdin, &sb_stdout, 0, buildRoot, NULL) == 0) {
Panu Matilainen c9c421
+    if (rpmfcExec(av, sb_stdin, &sb_stdout, 0, buildRoot) == 0) {
Panu Matilainen c9c421
 	argvSplit(&output, getStringBuf(sb_stdout), "\n\r");
Panu Matilainen c9c421
     }
Panu Matilainen c9c421
 
Panu Matilainen c9c421
@@ -1359,7 +1357,7 @@ static rpmRC rpmfcApplyExternal(rpmfc fc)
Panu Matilainen c9c421
 	free(s);
Panu Matilainen c9c421
 
Panu Matilainen c9c421
 	if (rpmfcExec(dm->argv, sb_stdin, &sb_stdout,
Panu Matilainen c9c421
-			failnonzero, fc->buildRoot, NULL) == -1)
Panu Matilainen c9c421
+			failnonzero, fc->buildRoot) == -1)
Panu Matilainen c9c421
 	    continue;
Panu Matilainen c9c421
 
Panu Matilainen c9c421
 	if (sb_stdout == NULL) {
Panu Matilainen c9c421
-- 
Panu Matilainen c9c421
2.21.0
Panu Matilainen c9c421