Skip to content

Commit

Permalink
perf probe: Fix to show correct error string
Browse files Browse the repository at this point in the history
Fix perf probe to show correct error string when it
fails to delete an event. The write(2) returns -1
if failed, and errno stores real error number.

Signed-off-by: Masami Hiramatsu <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/20111004104504.14591.41266.stgit@fedora15
Signed-off-by: Steven Rostedt <[email protected]>
  • Loading branch information
mhiramathitachi authored and rostedt committed Oct 10, 2011
1 parent 02ca152 commit 44a5604
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tools/perf/util/probe-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -1956,8 +1956,10 @@ static int __del_trace_probe_event(int fd, struct str_node *ent)

pr_debug("Writing event: %s\n", buf);
ret = write(fd, buf, strlen(buf));
if (ret < 0)
if (ret < 0) {
ret = -errno;
goto error;
}

printf("Remove event: %s\n", ent->s);
return 0;
Expand Down

0 comments on commit 44a5604

Please sign in to comment.