From 2fb750e825b5347de0390315f4284f13709a9856 Mon Sep 17 00:00:00 2001 From: Borislav Petkov Date: Mon, 31 May 2010 23:18:18 +0200 Subject: [PATCH] perf-record: Check correct pid when forking 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 Cc: Ingo Molnar Cc: Peter Zijlstra Cc: Arnaldo Carvalho de Melo Cc: Paul Mackerras Cc: Tom Zanussi Cc: Stephane Eranian LKML-Reference: <20100531211818.GA30175@liondog.tnic> Signed-off-by: Frederic Weisbecker --- tools/perf/builtin-record.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 9bc89050e6f8..dc3435e18bde 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) { perror("failed to fork"); exit(-1); } -- 2.20.1