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] popen: add missing ev_io initialization
Date: Mon, 23 Mar 2020 10:24:44 +0300	[thread overview]
Message-ID: <20200323072444.24660-1-gorcunov@gmail.com> (raw)

Otherwise it left unitialized and in result
may not work depending on dirty data got from
memory.

Fixes #4811

Reported-by: Nikita Pettik <korablev@tarantool.org>
Signed-off-by: Cyrill Gorcunov <gorcunov@gmail.com>
---
branch gorcunov/gh-4811-popen-coio

 src/lib/core/popen.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/src/lib/core/popen.c b/src/lib/core/popen.c
index a0630e3d9..99bd69b74 100644
--- a/src/lib/core/popen.c
+++ b/src/lib/core/popen.c
@@ -115,12 +115,8 @@ handle_new(struct popen_opts *opts)
 
 	rlist_create(&handle->list);
 
-	/*
-	 * No need to initialize the whole ios structure,
-	 * just set fd value to mark as unused.
-	 */
 	for (i = 0; i < lengthof(handle->ios); i++)
-		handle->ios[i].fd = -1;
+		coio_create(&handle->ios[i], -1);
 
 	say_debug("popen: alloc handle %p command '%s' flags %#x",
 		  handle, handle->command, opts->flags);
-- 
2.20.1

             reply	other threads:[~2020-03-23  7:24 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-23  7:24 Cyrill Gorcunov [this message]
2020-03-23 10:32 ` Nikita Pettik
2020-03-23 10:44   ` Nikita Pettik
2020-03-23 11:09     ` 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=20200323072444.24660-1-gorcunov@gmail.com \
    --to=gorcunov@gmail.com \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH] popen: add missing ev_io initialization' \
    /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