From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751916AbcGMHNu (ORCPT ); Wed, 13 Jul 2016 03:13:50 -0400 Received: from terminus.zytor.com ([198.137.202.10]:41112 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751232AbcGMHNs (ORCPT ); Wed, 13 Jul 2016 03:13:48 -0400 Date: Wed, 13 Jul 2016 00:12:53 -0700 From: tip-bot for Arnaldo Carvalho de Melo Message-ID: Cc: wangnan0@huawei.com, linux-kernel@vger.kernel.org, namhyung@kernel.org, mingo@kernel.org, adrian.hunter@intel.com, acme@redhat.com, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, rostedt@goodmis.org, dsahern@gmail.com Reply-To: linux-kernel@vger.kernel.org, wangnan0@huawei.com, mingo@kernel.org, namhyung@kernel.org, adrian.hunter@intel.com, acme@redhat.com, jolsa@kernel.org, hpa@zytor.com, tglx@linutronix.de, rostedt@goodmis.org, dsahern@gmail.com To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] tools lib traceevent: Use str_error_r() Git-Commit-ID: c3cec9e68f12d0046f991378391172958b5315d9 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 Commit-ID: c3cec9e68f12d0046f991378391172958b5315d9 Gitweb: http://git.kernel.org/tip/c3cec9e68f12d0046f991378391172958b5315d9 Author: Arnaldo Carvalho de Melo AuthorDate: Fri, 8 Jul 2016 15:21:37 -0300 Committer: Arnaldo Carvalho de Melo CommitDate: Tue, 12 Jul 2016 15:20:28 -0300 tools lib traceevent: Use str_error_r() To make it portable to non-glibc systems, that follow the XSI variant instead of the GNU specific one that gets in place when _GNU_SOURCE is defined. Cc: Adrian Hunter Cc: David Ahern Cc: Jiri Olsa Cc: Namhyung Kim Cc: Steven Rostedt Cc: Wang Nan Link: http://lkml.kernel.org/n/tip-c1gn8x978qfop65m510wy43o@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/lib/traceevent/event-parse.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c index a8b6357..3a7bd17 100644 --- a/tools/lib/traceevent/event-parse.c +++ b/tools/lib/traceevent/event-parse.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "event-parse.h" @@ -6131,12 +6132,7 @@ int pevent_strerror(struct pevent *pevent __maybe_unused, const char *msg; if (errnum >= 0) { - msg = strerror_r(errnum, buf, buflen); - if (msg != buf) { - size_t len = strlen(msg); - memcpy(buf, msg, min(buflen - 1, len)); - *(buf + min(buflen - 1, len)) = '\0'; - } + str_error_r(errnum, buf, buflen); return 0; }