aboutsummaryrefslogtreecommitdiff
path: root/tools/lib/traceevent/event-utils.h
diff options
context:
space:
mode:
authorNamhyung Kim <namhyung.kim@lge.com>2012-08-22 16:00:31 +0900
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-08-22 16:04:05 -0300
commite1aa7c30c599e99b4544f9e5b4c275c8a5325bdc (patch)
tree7d6bc8f37c52b63f49508aa1e0ab4ba2699be790 /tools/lib/traceevent/event-utils.h
parent2f197b9d7eeaa723a80243610956fe4a17e7b5a4 (diff)
tools lib traceevent: Fix strerror_r() use in pevent_strerror
glibc-2.16 starts to mark the function with attribute warn_unused_result so that it can cause a build warning. Since GNU version of strerror_r() can return a pointer to a string without setting @buf, check the return value and copy/truncate it to our buffer if needed. Signed-off-by: Namhyung Kim <namhyung@kernel.org> Acked-by: Kirill A. Shutemov <kirill@shutemov.name> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@kernel.org> Cc: Kirill A. Shutemov <kirill@shutemov.name> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Steven Rostedt <rostedt@goodmis.org> Link: http://lkml.kernel.org/r/1345618831-9148-5-git-send-email-namhyung@kernel.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/lib/traceevent/event-utils.h')
-rw-r--r--tools/lib/traceevent/event-utils.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/lib/traceevent/event-utils.h b/tools/lib/traceevent/event-utils.h
index 08296383d1e..bc075006966 100644
--- a/tools/lib/traceevent/event-utils.h
+++ b/tools/lib/traceevent/event-utils.h
@@ -39,6 +39,12 @@ void __vdie(const char *fmt, ...);
void __vwarning(const char *fmt, ...);
void __vpr_stat(const char *fmt, ...);
+#define min(x, y) ({ \
+ typeof(x) _min1 = (x); \
+ typeof(y) _min2 = (y); \
+ (void) (&_min1 == &_min2); \
+ _min1 < _min2 ? _min1 : _min2; })
+
static inline char *strim(char *string)
{
char *ret;