* [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event
@ 2009-08-14 18:26 Arnaldo Carvalho de Melo
2009-08-14 19:07 ` Valdis.Kletnieks
2009-08-15 10:06 ` [tip:perfcounters/urgent] " tip-bot for Arnaldo Carvalho de Melo
0 siblings, 2 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-08-14 18:26 UTC (permalink / raw)
To: Ingo Molnar; +Cc: Peter Zijlstra, Linux Kernel Mailing List
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...
Reported-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/builtin-record.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e67c4fa..65b4115 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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:
*/
--
1.6.2.5
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event
2009-08-14 18:26 [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event Arnaldo Carvalho de Melo
@ 2009-08-14 19:07 ` Valdis.Kletnieks
2009-08-14 20:10 ` Arnaldo Carvalho de Melo
2009-08-15 10:06 ` [tip:perfcounters/urgent] " tip-bot for Arnaldo Carvalho de Melo
1 sibling, 1 reply; 5+ messages in thread
From: Valdis.Kletnieks @ 2009-08-14 19:07 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ingo Molnar, Peter Zijlstra, Linux Kernel Mailing List
[-- Attachment #1: Type: text/plain, Size: 353 bytes --]
On Fri, 14 Aug 2009 15:26:32 -0300, Arnaldo Carvalho de Melo said:
> 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... :)
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event
2009-08-14 19:07 ` Valdis.Kletnieks
@ 2009-08-14 20:10 ` Arnaldo Carvalho de Melo
2009-08-15 9:56 ` Ingo Molnar
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2009-08-14 20:10 UTC (permalink / raw)
To: Valdis.Kletnieks; +Cc: Ingo Molnar, Peter Zijlstra, Linux Kernel Mailing List
Em Fri, Aug 14, 2009 at 03:07:11PM -0400, Valdis.Kletnieks@vt.edu escreveu:
> On Fri, 14 Aug 2009 15:26:32 -0300, Arnaldo Carvalho de Melo said:
> > 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
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event
2009-08-14 20:10 ` Arnaldo Carvalho de Melo
@ 2009-08-15 9:56 ` Ingo Molnar
0 siblings, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-08-15 9:56 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Valdis.Kletnieks, Peter Zijlstra, Linux Kernel Mailing List
* Arnaldo Carvalho de Melo <acme@redhat.com> wrote:
> Em Fri, Aug 14, 2009 at 03:07:11PM -0400, Valdis.Kletnieks@vt.edu escreveu:
> > On Fri, 14 Aug 2009 15:26:32 -0300, Arnaldo Carvalho de Melo said:
> > > 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 :-)
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
^ permalink raw reply [flat|nested] 5+ messages in thread
* [tip:perfcounters/urgent] perf record: Fix typo in pid_synthesize_comm_event
2009-08-14 18:26 [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event Arnaldo Carvalho de Melo
2009-08-14 19:07 ` Valdis.Kletnieks
@ 2009-08-15 10:06 ` tip-bot for Arnaldo Carvalho de Melo
1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Arnaldo Carvalho de Melo @ 2009-08-15 10:06 UTC (permalink / raw)
To: linux-tip-commits
Cc: linux-kernel, drepper, acme, hpa, mingo, peterz, tglx, mingo
Commit-ID: 39e6dd73502f64e2ae3236b304e160ae30de9384
Gitweb: http://git.kernel.org/tip/39e6dd73502f64e2ae3236b304e160ae30de9384
Author: Arnaldo Carvalho de Melo <acme@redhat.com>
AuthorDate: Fri, 14 Aug 2009 15:26:32 -0300
Committer: Ingo Molnar <mingo@elte.hu>
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 ...
Reported-by: Ulrich Drepper <drepper@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
LKML-Reference: <20090814182632.GF3490@ghostprotocols.net>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
tools/perf/builtin-record.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 3d051b9..89a5ddc 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -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:
*/
^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-08-15 10:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-08-14 18:26 [PATCH tip 1/1] perf record: Fix typo in pid_synthesize_comm_event Arnaldo Carvalho de Melo
2009-08-14 19:07 ` Valdis.Kletnieks
2009-08-14 20:10 ` Arnaldo Carvalho de Melo
2009-08-15 9:56 ` Ingo Molnar
2009-08-15 10:06 ` [tip:perfcounters/urgent] " tip-bot for Arnaldo Carvalho de Melo
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox