[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1516115090.12026.24.camel@gmail.com>
Date: Tue, 16 Jan 2018 17:04:50 +0200
From: Vladislav Valtchev <vladislav.valtchev@...il.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: y.karadz@...il.com, linux-trace-devel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 2/3] trace-cmd: Remove the die() call from read_proc()
On Fri, 2018-01-12 at 10:43 -0500, Steven Rostedt wrote:
>
> But you need to handle the error cases for the users of read_proc().
> From the previous patch:
>
> static void change_stack_tracer_status(int new_status)
> {
> char buf[1];
> int status;
> int fd;
> int n;
>
> if (read_proc(&status) > 0 && status == new_status)
> return; /* nothing to do */
>
> We should not continue if read_proc() fails. Should move the die here:
>
> ret = read_proc(&status);
> if (ret < 0)
> die("error reading %s", PROC_FILE);
>
> if (ret > 0 && status == new_status)
> return; /* nothing to do */
>
> -- Steve
>
You're totally right. I overlooked at this detail.
--
Vladislav Valtchev
VMware Open Source Technology Center
Powered by blists - more mailing lists