summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPetri Latvala <petri.latvala@intel.com>2019-01-16 13:20:47 +0200
committerPetri Latvala <petri.latvala@intel.com>2019-01-21 13:51:01 +0200
commite076451b2db4b276a7f5be38d32c15d477fa5f04 (patch)
tree972045bc38cbdc714fac713cc247cf93755ea2e0
parentcc6474a9b36f30bd1d11bb169ecdca0a149cd135 (diff)
lib/igt_core: Initialize fds in igt_system_quiet
This avoids calling close() with uninitialized ints if some dup() calls succeed and others don't. Signed-off-by: Petri Latvala <petri.latvala@intel.com> Cc: Abdiel Janulgue <abdiel.janulgue@linux.intel.com> Reviewed-by: Abdiel Janulgue <abdiel.janulgue@linux.intel.com>
-rw-r--r--lib/igt_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/igt_core.c b/lib/igt_core.c
index 0cae9b6a..49fbf70d 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -2391,7 +2391,7 @@ err:
*/
int igt_system_quiet(const char *command)
{
- int stderr_fd_copy, stdout_fd_copy, status, nullfd;
+ int stderr_fd_copy = -1, stdout_fd_copy = -1, status, nullfd = -1;
/* redirect */
if ((nullfd = open("/dev/null", O_WRONLY)) == -1)