perf record: Fix typo in pid_synthesize_comm_event
PATCH 1/1 perf record: Fix typo in pid_synthesize_comm_event
We were using 'fd' locally, but there was a global 'fd' too, so when converting from open to fopen the test made against fd should be made against 'fp', but since we have that global...
--- tools/perf/builtin-record.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-record.c +1 -1
@@ -201,7 +201,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full)snprintf (filename,sizeof (filename),"/proc/%d/status" , pid); fp =fopen (filename,"r" ); -if (fd ==NULL ) { +if (fp ==NULL ) {/* * We raced with a task exiting - just return: */
Signature · 1 line
1.6.2.5
Quoted 3 lines · Arnaldo Carvalho de Melo
We were using 'fd' locally, but there was a global 'fd' too, so when converting from open to fopen the test made against fd should be made against 'fp', but since we have that global...
If the kernel was -Wshadow safe by default, this sort of thing would happen less often... :)
Em Fri, Aug 14, 2009 at 03:07:11PM -0400, [email protected] escreveu:
Quoted 7 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
We were using 'fd' locally, but there was a global 'fd' too, so when converting from open to fopen the test made against fd should be made against 'fp', but since we have that global...
If the kernel was -Wshadow safe by default, this sort of thing would happen less often... :)
I would love to have that kind of problem spotted by the compiler, but this is no kernel code, the CFLAGS we use is different than the kernel ones, I guess a patch for tools/perf/ would be gladly accepted by Ingo, but let him say so :-)
- Arnaldo
Quoted 6 lines · Arnaldo Carvalho de Melo
Em Fri, Aug 14, 2009 at 03:07:11PM -0400, [email protected] escreveu:
Quoted 5 lines · Arnaldo Carvalho de Melo
Quoted 3 lines
We were using 'fd' locally, but there was a global 'fd' too, so when converting from open to fopen the test made against fd should be made against 'fp', but since we have that global...
Quoted 7 lines
Quoted 2 lines
If the kernel was -Wshadow safe by default, this sort of thing would happen less often... :)
I would love to have that kind of problem spotted by the compiler, but this is no kernel code, the CFLAGS we use is different than the kernel ones, I guess a patch for
tools/perf/would be gladly accepted by Ingo, but let him say so :-)
Yeah. We are using -Wall and -Wextra right now - but -Wshadow is not turned on by them.
Does gcc ignore non-existent warnings or do we have to probe them in the Makefile, to support older versions of GCC?
Ingo
Commit-ID: 39e6dd73502f64e2ae3236b304e160ae30de9384 Gitweb: http://git.kernel.org/tip/39e6dd73502f64e2ae3236b304e160ae30de9384 Author: Arnaldo Carvalho de Melo <[email protected]> AuthorDate: Fri, 14 Aug 2009 15:26:32 -0300 Committer: Ingo Molnar <[email protected]> CommitDate: Sat, 15 Aug 2009 11:59:06 +0200
perf record: Fix typo in pid_synthesize_comm_event
We were using 'fd' locally, but there was a global 'fd' too, so when converting from open to fopen the test made against fd should be made against 'fp', but since we have that global it didnt get discovered ...
LKML-Reference: <[email protected]>
--- tools/perf/builtin-record.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
tools/perf/builtin-record.c +1 -1
@@ -219,7 +219,7 @@ static pid_t pid_synthesize_comm_event(pid_t pid, int full)snprintf (filename,sizeof (filename),"/proc/%d/status" , pid); fp =fopen (filename,"r" ); -if (fd ==NULL ) { +if (fp ==NULL ) {/* * We raced with a task exiting - just return: */