diff options
author | Masami Hiramatsu <mhiramat@kernel.org> | 2016-04-26 05:03:04 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2016-04-26 12:14:58 -0400 |
commit | 6ed0720a74d90eea51284c07592369d45d56f1f7 (patch) | |
tree | 4ce72676282c9453d466b970d9cf7b0eadba8e50 /tools/perf | |
parent | e1ce726e1db2522b4848b3acffb7ece12439517c (diff) |
perf probe: Let probe_file__add_event return 0 if succeeded
Since other methods return 0 if succeeded (or filedesc), let
probe_file__add_event() return 0 instead of the length of written bytes.
Signed-off-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
Cc: Hemant Kumar <hemant@linux.vnet.ibm.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20160426090303.11891.18232.stgit@devbox
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/util/probe-file.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index e3b3b92e4458..3fe6214970e6 100644 --- a/tools/perf/util/probe-file.c +++ b/tools/perf/util/probe-file.c | |||
@@ -220,8 +220,7 @@ int probe_file__add_event(int fd, struct probe_trace_event *tev) | |||
220 | 220 | ||
221 | pr_debug("Writing event: %s\n", buf); | 221 | pr_debug("Writing event: %s\n", buf); |
222 | if (!probe_event_dry_run) { | 222 | if (!probe_event_dry_run) { |
223 | ret = write(fd, buf, strlen(buf)); | 223 | if (write(fd, buf, strlen(buf)) < (int)strlen(buf)) { |
224 | if (ret <= 0) { | ||
225 | ret = -errno; | 224 | ret = -errno; |
226 | pr_warning("Failed to write event: %s\n", | 225 | pr_warning("Failed to write event: %s\n", |
227 | strerror_r(errno, sbuf, sizeof(sbuf))); | 226 | strerror_r(errno, sbuf, sizeof(sbuf))); |