From: "Gix, Brian" <brian.gix@intel.com>
To: "biradar.a@samsung.com" <biradar.a@samsung.com>,
"linux-bluetooth@vger.kernel.org"
<linux-bluetooth@vger.kernel.org>
Subject: Re: [PATCH 1/1] meshctl: Fix infinite sock read
Date: Mon, 6 Jan 2020 15:36:18 +0000 [thread overview]
Message-ID: <202bf1a0b3d1be8a42d2a7b842978b5a20fdb451.camel@intel.com> (raw)
In-Reply-To: <1575605584-734-1-git-send-email-biradar.a@samsung.com>
Applied
On Fri, 2019-12-06 at 09:43 +0530, Anurag Biradar wrote:
> When a stream socket peer has performed an orderly shutdown,
> then return value will be 0.
> ---
> tools/mesh-gatt/gatt.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/tools/mesh-gatt/gatt.c b/tools/mesh-gatt/gatt.c
> index bff5947..1bd9868 100644
> --- a/tools/mesh-gatt/gatt.c
> +++ b/tools/mesh-gatt/gatt.c
> @@ -416,7 +416,7 @@ static bool sock_read(struct io *io, bool prov, void *user_data)
> msg.msg_iovlen = 1;
>
> while ((len = recvmsg(fd, &msg, MSG_DONTWAIT))) {
> - if (len <= 0) {
> + if (len < 0) {
> if (errno == EAGAIN)
> break;
> return false;
> @@ -431,6 +431,11 @@ static bool sock_read(struct io *io, bool prov, void *user_data)
> net_data_ready(res, len_sar);
> }
> }
> +
> + /* When socket is orderly closed, then recvmsg returns 0 */
> + if (len == 0)
> + return false;
> +
> return true;
> }
>
prev parent reply other threads:[~2020-01-06 15:36 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20191206041323epcas5p35d6b7b22e50698d10af05d669001fd5a@epcas5p3.samsung.com>
2019-12-06 4:13 ` [PATCH 1/1] meshctl: Fix infinite sock read Anurag Biradar
2020-01-05 15:50 ` anurag biradar
2020-01-06 15:36 ` Gix, Brian [this message]
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=202bf1a0b3d1be8a42d2a7b842978b5a20fdb451.camel@intel.com \
--to=brian.gix@intel.com \
--cc=biradar.a@samsung.com \
--cc=linux-bluetooth@vger.kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).