lkml.org 
[lkml]   [2010]   [May]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] perf-record: Check correct pid when forking
On Mon, May 31, 2010 at 11:18:18PM +0200, Borislav Petkov wrote:
> When forking the child to be traced, we should check the correct return
> value from fork() and not a local variable which is otherwise unused.
>
> Signed-off-by: Borislav Petkov <bp@alien8.de>
> ---
> tools/perf/builtin-record.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
> index 9bc8905..dc3435e 100644
> --- a/tools/perf/builtin-record.c
> +++ b/tools/perf/builtin-record.c
> @@ -503,7 +503,6 @@ static int __cmd_record(int argc, const char **argv)
> {
> int i, counter;
> struct stat st;
> - pid_t pid = 0;
> int flags;
> int err;
> unsigned long waking = 0;
> @@ -572,7 +571,7 @@ static int __cmd_record(int argc, const char **argv)
>
> if (forks) {
> child_pid = fork();
> - if (pid < 0) {
> + if (child_pid < 0) {



Oops :)


Since I'm preparing some fixes for .35 in perf tools, I'm queuing this one
too.

Thanks.



\
 
 \ /
  Last update: 2010-05-31 23:29    [W:0.918 / U:0.020 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site