Tarantool development patches archive
 help / color / mirror / Atom feed
* [Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access
@ 2020-02-28  7:40 Cyrill Gorcunov
  2020-02-28  8:52 ` Cyrill Gorcunov
  0 siblings, 1 reply; 2+ messages in thread
From: Cyrill Gorcunov @ 2020-02-28  7:40 UTC (permalink / raw)
  To: tml

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@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access
  2020-02-28  7:40 [Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access Cyrill Gorcunov
@ 2020-02-28  8:52 ` Cyrill Gorcunov
  0 siblings, 0 replies; 2+ messages in thread
From: Cyrill Gorcunov @ 2020-02-28  8:52 UTC (permalink / raw)
  To: tml

On Fri, Feb 28, 2020 at 10:40:09AM +0300, Cyrill Gorcunov wrote:
> 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@gmail.com>

Drop it.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-28  8:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-28  7:40 [Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access Cyrill Gorcunov
2020-02-28  8:52 ` Cyrill Gorcunov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox