aboutsummaryrefslogtreecommitdiff
path: root/tools/lib
diff options
context:
space:
mode:
authorArnaldo Carvalho de Melo <[email protected]>2016-07-08 15:21:37 -0300
committerArnaldo Carvalho de Melo <[email protected]>2016-07-12 15:20:28 -0300
commitc3cec9e68f12d0046f991378391172958b5315d9 (patch)
tree713ef1e647d5c85dad2702ecbc4f91400af31103 /tools/lib
parentd0761e37fe3fed7810ed8d6e130b79359f0c3e13 (diff)
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 <[email protected]> Cc: David Ahern <[email protected]> Cc: Jiri Olsa <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Wang Nan <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
Diffstat (limited to 'tools/lib')
-rw-r--r--tools/lib/traceevent/event-parse.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index a8b6357d1ffe..3a7bd175f73c 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -31,6 +31,7 @@
#include <errno.h>
#include <stdint.h>
#include <limits.h>
+#include <linux/string.h>
#include <netinet/ip6.h>
#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;
}