Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752454AbcDZNtO (ORCPT ); Tue, 26 Apr 2016 09:49:14 -0400 Received: from mail.kernel.org ([198.145.29.136]:39996 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751915AbcDZNtL (ORCPT ); Tue, 26 Apr 2016 09:49:11 -0400 Date: Tue, 26 Apr 2016 10:49:07 -0300 From: Arnaldo Carvalho de Melo To: Masami Hiramatsu Cc: linux-kernel@vger.kernel.org, Namhyung Kim , Peter Zijlstra , Ingo Molnar , Hemant Kumar , Ananth N Mavinakayanahalli Subject: Re: [PATCH perf/core v4 06/19] perf-probe: Let probe_file__add_event return 0 if succeeded Message-ID: <20160426134907.GC20998@kernel.org> References: <20160426090200.11891.43944.stgit@devbox> <20160426090303.11891.18232.stgit@devbox> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20160426090303.11891.18232.stgit@devbox> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 982 Lines: 28 Em Tue, Apr 26, 2016 at 06:03:04PM +0900, Masami Hiramatsu escreveu: > Since other methods return 0 if succeeded (or filedesc), > let probe_file__add_event() return 0 instead of the length > of written bytes. Thanks, applied. - Arnaldo > Signed-off-by: Masami Hiramatsu > --- > 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)));