From e076451b2db4b276a7f5be38d32c15d477fa5f04 Mon Sep 17 00:00:00 2001 From: Petri Latvala Date: Wed, 16 Jan 2019 13:20:47 +0200 Subject: 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 Cc: Abdiel Janulgue Reviewed-by: Abdiel Janulgue --- lib/igt_core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/igt_core.c') 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) -- cgit v1.2.3