]> Git Repo - linux.git/commitdiff
perf-record: Check correct pid when forking
authorBorislav Petkov <[email protected]>
Mon, 31 May 2010 21:18:18 +0000 (23:18 +0200)
committerFrederic Weisbecker <[email protected]>
Mon, 31 May 2010 22:57:14 +0000 (00:57 +0200)
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 <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Tom Zanussi <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <20100531211818[email protected]>
Signed-off-by: Frederic Weisbecker <[email protected]>
tools/perf/builtin-record.c

index 9bc89050e6f8642cf65cbfbd354c7a8f209cd816..dc3435e18bdeb18cfdcb8e2a08a21a98cc695a2d 100644 (file)
@@ -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);
                }
This page took 0.057827 seconds and 4 git commands to generate.