Blame SOURCES/0269-lib-spawn-Explicitly-initialize-array.patch

28bab8
From 0eb1bff4cf000777734e611f9673e18a868d25b1 Mon Sep 17 00:00:00 2001
28bab8
From: Ernestas Kulik <ekulik@redhat.com>
28bab8
Date: Mon, 10 Jun 2019 15:19:00 +0200
28bab8
Subject: [PATCH] lib: spawn: Explicitly initialize array
28bab8
MIME-Version: 1.0
28bab8
Content-Type: text/plain; charset=UTF-8
28bab8
Content-Transfer-Encoding: 8bit
28bab8
28bab8
Clang seems to think that the call just after declaring it doesn’t
28bab8
set any values.
28bab8
28bab8
Signed-off-by: Ernestas Kulik <ekulik@redhat.com>
28bab8
---
28bab8
 src/lib/spawn.c | 5 ++++-
28bab8
 1 file changed, 4 insertions(+), 1 deletion(-)
28bab8
28bab8
diff --git a/src/lib/spawn.c b/src/lib/spawn.c
28bab8
index 7effe5c..c52cbf7 100644
28bab8
--- a/src/lib/spawn.c
28bab8
+++ b/src/lib/spawn.c
28bab8
@@ -160,7 +160,10 @@ char *run_in_shell_and_save_output(int flags,
28bab8
 	flags &= ~EXECFLG_INPUT;
28bab8
 
28bab8
 	const char *argv[] = { "/bin/sh", "-c", cmd, NULL };
28bab8
-	int pipeout[2];
28bab8
+	/* Clang seems to think that pipeout[0] is uninitialized when calling
28bab8
+     * safe_read().
28bab8
+	 */
28bab8
+	int pipeout[2] = { 0 };
28bab8
 	pid_t child = fork_execv_on_steroids(flags, (char **)argv, pipeout,
28bab8
 		/*env_vec:*/ NULL, dir, /*uid (unused):*/ 0);
28bab8
 
28bab8
-- 
28bab8
2.21.0
28bab8