tools lib traceevent: Fix strerror_r() use in pevent_strerror
authorNamhyung Kim <namhyung.kim@lge.com>
Wed, 22 Aug 2012 07:00:31 +0000 (16:00 +0900)
committerArnaldo Carvalho de Melo <acme@redhat.com>
Wed, 22 Aug 2012 19:04:05 +0000 (16:04 -0300)
commite1aa7c30c599e99b4544f9e5b4c275c8a5325bdc
tree7d6bc8f37c52b63f49508aa1e0ab4ba2699be790
parent2f197b9d7eeaa723a80243610956fe4a17e7b5a4
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>
tools/lib/traceevent/event-parse.c
tools/lib/traceevent/event-utils.h