summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-probe.c
diff options
context:
space:
mode:
authorMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>2014-08-14 02:22:34 +0000
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-08-15 10:56:53 -0300
commit5f03cba41590b5e7db5b66d2b2aa3e146ff8a84f (patch)
treec4f66ad54a3069044bf3548f5cd38c0ac7054876 /tools/perf/builtin-probe.c
parentb2348e1d8a67c58de44820587fabc4f987eafbb6 (diff)
downloadlinux-5f03cba41590b5e7db5b66d2b2aa3e146ff8a84f.tar.gz
linux-5f03cba41590b5e7db5b66d2b2aa3e146ff8a84f.tar.bz2
linux-5f03cba41590b5e7db5b66d2b2aa3e146ff8a84f.zip
perf probe: Make error messages thread-safe
To make error messages thread-safe, this replaces strerror with strerror_r for warnings, and just shows the return value instead of using strerror for debug messages. Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Naohiro Aota <naota@elisp.net> Cc: Paul Mackerras <paulus@samba.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Link: http://lkml.kernel.org/r/20140814022234.3545.22199.stgit@kbuild-fedora.novalocal Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-probe.c')
-rw-r--r--tools/perf/builtin-probe.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/builtin-probe.c b/tools/perf/builtin-probe.c
index c63fa2925075..347729e29a92 100644
--- a/tools/perf/builtin-probe.c
+++ b/tools/perf/builtin-probe.c
@@ -290,8 +290,11 @@ static void cleanup_params(void)
static void pr_err_with_code(const char *msg, int err)
{
+ char sbuf[STRERR_BUFSIZE];
+
pr_err("%s", msg);
- pr_debug(" Reason: %s (Code: %d)", strerror(-err), err);
+ pr_debug(" Reason: %s (Code: %d)",
+ strerror_r(-err, sbuf, sizeof(sbuf)), err);
pr_err("\n");
}