Tarantool development patches archive
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: tml <tarantool-patches@dev.tarantool.org>
Subject: [Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access
Date: Fri, 28 Feb 2020 10:40:09 +0300	[thread overview]
Message-ID: <20200228074009.32669-1-gorcunov@gmail.com> (raw)

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

             reply	other threads:[~2020-02-28  7:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-28  7:40 Cyrill Gorcunov [this message]
2020-02-28  8:52 ` Cyrill Gorcunov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200228074009.32669-1-gorcunov@gmail.com \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] test: unit/popen -- fix potential uninitialized access' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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