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 <bp@alien8.de> Cc: Ingo Molnar <mingo@elte.hu> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Paul Mackerras <paulus@samba.org> Cc: Tom Zanussi <tzanussi@gmail.com> Cc: Stephane Eranian <eranian@google.com> LKML-Reference: <20100531211818.GA30175@liondog.tnic> Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
This commit is contained in:
committed by
Frederic Weisbecker
parent
dd833d713c
commit
2fb750e825
@@ -503,7 +503,6 @@ static int __cmd_record(int argc, const char **argv)
|
|||||||
{
|
{
|
||||||
int i, counter;
|
int i, counter;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
pid_t pid = 0;
|
|
||||||
int flags;
|
int flags;
|
||||||
int err;
|
int err;
|
||||||
unsigned long waking = 0;
|
unsigned long waking = 0;
|
||||||
@@ -572,7 +571,7 @@ static int __cmd_record(int argc, const char **argv)
|
|||||||
|
|
||||||
if (forks) {
|
if (forks) {
|
||||||
child_pid = fork();
|
child_pid = fork();
|
||||||
if (pid < 0) {
|
if (child_pid < 0) {
|
||||||
perror("failed to fork");
|
perror("failed to fork");
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user