From: Eli Zaretskii <eliz@gnu.org>
To: Terry Guo <terry.guo@arm.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH]Fix that GDB will get hang on Windows when using pipe to get stdout and stderr from stub
Date: Thu, 12 Jul 2012 05:20:00 -0000 [thread overview]
Message-ID: <83ehohblor.fsf@gnu.org> (raw)
In-Reply-To: <000301cd5fcf$838d31b0$8aa79510$%guo@arm.com>
> From: "Terry Guo" <terry.guo@arm.com>
> Cc: <gdb-patches@sourceware.org>
> Date: Thu, 12 Jul 2012 09:41:51 +0800
>
> Changes are about code secure and readability. No functionality change.
>
> 1). Previously I have code:
>
> char buf[81];
> int to_read = 80;
>
> Now I change it to:
>
> #define GDB_MI_MSG_WIDTH 80
>
> char buf[GDB_MI_MSG_WIDTH + 1];
> int to_read = GDB_MI_MSG_WIDTH;
>
> 2). Another change is to add string length check. It is:
>
> s = read (scb->error_fd, &buf, to_read);
>
> if ((s == -1) || (s == 0 && !close_fd))
> break
>
> if (s == 0 && close_fd)
> {
> ....
> }
>
> /* Current patch add this new line to check length */
> gdb_assert (s > 0 && s <= GDB_MI_MSG_WIDTH);
>
> buf[s] = '\0';
Thanks. These are all no-brainers, so I think the patch is still good
to go in.
next prev parent reply other threads:[~2012-07-12 5:20 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <000001cd5338$ded61b20$9c825160$%guo@arm.com>
[not found] ` <000501cd5404$fbf210c0$f3d63240$%guo@arm.com>
2012-06-27 3:06 ` Eli Zaretskii
2012-06-27 16:54 ` Eli Zaretskii
2012-07-04 8:19 ` Terry Guo
2012-07-11 5:00 ` Terry Guo
[not found] ` <000301cd59bd$ce1c8900$6a559b00$%guo@arm.com>
[not found] ` <000101cd5f22$2371cdc0$6a556940$%guo@arm.com>
2012-07-11 18:36 ` Eli Zaretskii
2012-07-12 1:41 ` Terry Guo
[not found] ` <000301cd5fcf$838d31b0$8aa79510$%guo@arm.com>
2012-07-12 5:20 ` Eli Zaretskii [this message]
2012-07-16 5:51 ` Terry Guo
2012-07-17 1:28 ` Sergio Durigan Junior
2012-07-17 3:05 ` Terry Guo
2012-07-17 7:51 ` Terry Guo
2012-07-17 17:21 ` Sergio Durigan Junior
2012-07-16 6:08 ` Terry Guo
2012-07-16 6:38 ` Yao Qi
2012-07-16 6:55 ` Terry Guo
2012-07-16 7:19 ` Yao Qi
2012-07-16 8:10 ` Terry Guo
2012-06-26 1:12 Terry Guo
2012-06-27 1:33 ` Terry Guo
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=83ehohblor.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=gdb-patches@sourceware.org \
--cc=terry.guo@arm.com \
/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
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox