Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753565AbcD0PgI (ORCPT ); Wed, 27 Apr 2016 11:36:08 -0400 Received: from terminus.zytor.com ([198.137.202.10]:51172 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752270AbcD0PgF (ORCPT ); Wed, 27 Apr 2016 11:36:05 -0400 Date: Wed, 27 Apr 2016 08:35:33 -0700 From: tip-bot for Masami Hiramatsu Message-ID: Cc: hemant@linux.vnet.ibm.com, mhiramat@kernel.org, linux-kernel@vger.kernel.org, hpa@zytor.com, acme@redhat.com, ananth@linux.vnet.ibm.com, tglx@linutronix.de, peterz@infradead.org, namhyung@kernel.org, mingo@kernel.org Reply-To: hemant@linux.vnet.ibm.com, acme@redhat.com, ananth@linux.vnet.ibm.com, hpa@zytor.com, linux-kernel@vger.kernel.org, mhiramat@kernel.org, tglx@linutronix.de, namhyung@kernel.org, mingo@kernel.org, peterz@infradead.org In-Reply-To: <20160426090303.11891.18232.stgit@devbox> References: <20160426090303.11891.18232.stgit@devbox> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf probe: Let probe_file__add_event return 0 if succeeded Git-Commit-ID: 6ed0720a74d90eea51284c07592369d45d56f1f7 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1538 Lines: 37 Commit-ID: 6ed0720a74d90eea51284c07592369d45d56f1f7 Gitweb: http://git.kernel.org/tip/6ed0720a74d90eea51284c07592369d45d56f1f7 Author: Masami Hiramatsu AuthorDate: Tue, 26 Apr 2016 18:03:04 +0900 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 26 Apr 2016 13:14:58 -0300 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 Cc: Ananth N Mavinakayanahalli Cc: Hemant Kumar Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20160426090303.11891.18232.stgit@devbox Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/probe-file.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tools/perf/util/probe-file.c b/tools/perf/util/probe-file.c index e3b3b92..3fe6214 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) pr_debug("Writing event: %s\n", buf); if (!probe_event_dry_run) { - ret = write(fd, buf, strlen(buf)); - if (ret <= 0) { + if (write(fd, buf, strlen(buf)) < (int)strlen(buf)) { ret = -errno; pr_warning("Failed to write event: %s\n", strerror_r(errno, sbuf, sizeof(sbuf)));