Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

perf trace: Use strerror_r instead of strerror

Use strerror_r instead of strerror in error message for thead-safety.

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/20140814022241.3545.97543.stgit@kbuild-fedora.novalocal
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>

authored by

Masami Hiramatsu and committed by
Arnaldo Carvalho de Melo
942a91ed 809adea6

+4 -2
+4 -2
tools/perf/builtin-trace.c
··· 1750 1750 signed_print: 1751 1751 fprintf(trace->output, ") = %d", ret); 1752 1752 } else if (ret < 0 && sc->fmt->errmsg) { 1753 - char bf[256]; 1753 + char bf[STRERR_BUFSIZE]; 1754 1754 const char *emsg = strerror_r(-ret, bf, sizeof(bf)), 1755 1755 *e = audit_errno_to_name(-ret); 1756 1756 ··· 2044 2044 int err = -1, i; 2045 2045 unsigned long before; 2046 2046 const bool forks = argc > 0; 2047 + char sbuf[STRERR_BUFSIZE]; 2047 2048 2048 2049 trace->live = true; 2049 2050 ··· 2106 2105 2107 2106 err = perf_evlist__mmap(evlist, trace->opts.mmap_pages, false); 2108 2107 if (err < 0) { 2109 - fprintf(trace->output, "Couldn't mmap the events: %s\n", strerror(errno)); 2108 + fprintf(trace->output, "Couldn't mmap the events: %s\n", 2109 + strerror_r(errno, sbuf, sizeof(sbuf))); 2110 2110 goto out_delete_evlist; 2111 2111 } 2112 2112