All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf-record: Check correct pid when forking
@ 2010-05-31 21:18 Borislav Petkov
  2010-05-31 21:27 ` Frederic Weisbecker
  2010-06-01  7:04 ` [tip:perf/urgent] " tip-bot for Borislav Petkov
  0 siblings, 2 replies; 4+ messages in thread
From: Borislav Petkov @ 2010-05-31 21:18 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo; +Cc: Peter Zijlstra, Ingo Molnar, lkml

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) {
 			perror("failed to fork");
 			exit(-1);
 		}
-- 
1.7.1


-- 
Regards/Gruss,
    Boris.

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2010-06-01  7:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-31 21:18 [PATCH] perf-record: Check correct pid when forking Borislav Petkov
2010-05-31 21:27 ` Frederic Weisbecker
2010-05-31 21:40   ` Borislav Petkov
2010-06-01  7:04 ` [tip:perf/urgent] " tip-bot for Borislav Petkov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.