[Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access

Cyrill Gorcunov gorcunov at gmail.com
Fri Feb 28 10:40:09 MSK 2020


If handle allocation failed we may access unitialized
variable. Not a big deal in this particular case but
better to be on safe side and make compilers happy.

Signed-off-by: Cyrill Gorcunov <gorcunov at gmail.com>
---

Otherwise some compiers complain and master branch doesn't pass testing.

 test/unit/popen.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/unit/popen.c b/test/unit/popen.c
index f364cee14..03c3d952f 100644
--- a/test/unit/popen.c
+++ b/test/unit/popen.c
@@ -53,7 +53,7 @@ popen_write_exit(void)
 			POPEN_FLAG_FD_STDERR		|
 			TEST_POPEN_COMMON_FLAGS,
 	};
-	int rc;
+	int rc = -1;
 
 	plan(7);
 	header();
@@ -123,7 +123,7 @@ popen_read_exit(void)
 			POPEN_FLAG_FD_STDERR		|
 			TEST_POPEN_COMMON_FLAGS,
 	};
-	int rc;
+	int rc = -1;
 
 	plan(5);
 	header();
@@ -181,7 +181,7 @@ popen_kill(void)
 			POPEN_FLAG_FD_STDERR		|
 			TEST_POPEN_COMMON_FLAGS,
 	};
-	int rc;
+	int rc = -1;
 
 	plan(4);
 	header();
-- 
2.20.1



More information about the Tarantool-patches mailing list