From: Steven Rostedt <rostedt@goodmis.org>
To: "Tzvetomir Stoyanov (VMware)" <tz.stoyanov@gmail.com>
Cc: linux-trace-devel@vger.kernel.org
Subject: Re: [PATCH 2/2] trace-cmd: Fix broken listener and add error checks
Date: Wed, 17 Feb 2021 14:46:43 -0500 [thread overview]
Message-ID: <20210217144643.2f692e57@gandalf.local.home> (raw)
In-Reply-To: <20210217042341.1675546-3-tz.stoyanov@gmail.com>
> @@ -634,11 +638,12 @@ static int process_client(struct tracecmd_msg_handle *msg_handle,
> stop_msg_handle = msg_handle;
>
> /* Now we are ready to start reading data from the client */
> - if (msg_handle->version == V3_PROTOCOL)
> - tracecmd_msg_collect_data(msg_handle, ofd);
> - else
> + if (msg_handle->version == V3_PROTOCOL) {
> + ret = tracecmd_msg_collect_data(msg_handle, ofd);
> + } else {
> collect_metadata_from_client(msg_handle, ofd);
> -
> + ret = 0;
> + }
We should have collect_metadata_from_client() return an error too, and keep
the if statement simple (no need for brackets);
if (msg_handle->version == V3_PROTOCOL)
ret = tracecmd_msg_collect_data(msg_handle, ofd);
else
ret = collect_metadata_from_client(msg_handle, ofd);
There's a few "pdie"s in that function that should be converted to error
returns.
-- Steve
> stop_msg_handle = NULL;
>
> /* wait a little to let our readers finish reading */
prev parent reply other threads:[~2021-02-17 19:48 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-02-17 4:23 [PATCH 0/2] Fix listener and add trace file validation Tzvetomir Stoyanov (VMware)
2021-02-17 4:23 ` [PATCH 1/2] trace-cmd: Add validation for reading and writing trace.dat files Tzvetomir Stoyanov (VMware)
2021-02-17 16:00 ` Steven Rostedt
2021-02-17 16:33 ` Tzvetomir Stoyanov
2021-02-17 18:27 ` Steven Rostedt
2021-02-18 3:49 ` Tzvetomir Stoyanov
2021-02-18 14:23 ` Steven Rostedt
2021-02-17 4:23 ` [PATCH 2/2] trace-cmd: Fix broken listener and add error checks Tzvetomir Stoyanov (VMware)
2021-02-17 19:46 ` Steven Rostedt [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=20210217144643.2f692e57@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=linux-trace-devel@vger.kernel.org \
--cc=tz.stoyanov@gmail.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;
as well as URLs for NNTP newsgroup(s).