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

perf record: Use strerror_r instead of strerror

Use strerror_r instead of strerror in error messages for thread-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/20140814022243.3545.7411.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
35550da3 942a91ed

+4 -3
+4 -3
tools/perf/builtin-record.c
··· 161 161 162 162 if (perf_evlist__apply_filters(evlist)) { 163 163 error("failed to set filter with %d (%s)\n", errno, 164 - strerror(errno)); 164 + strerror_r(errno, msg, sizeof(msg))); 165 165 rc = -1; 166 166 goto out; 167 167 } ··· 175 175 "(current value: %u)\n", opts->mmap_pages); 176 176 rc = -errno; 177 177 } else { 178 - pr_err("failed to mmap with %d (%s)\n", errno, strerror(errno)); 178 + pr_err("failed to mmap with %d (%s)\n", errno, 179 + strerror_r(errno, msg, sizeof(msg))); 179 180 rc = -errno; 180 181 } 181 182 goto out; ··· 481 480 } 482 481 483 482 if (forks && workload_exec_errno) { 484 - char msg[512]; 483 + char msg[STRERR_BUFSIZE]; 485 484 const char *emsg = strerror_r(workload_exec_errno, msg, sizeof(msg)); 486 485 pr_err("Workload failed: %s\n", emsg); 487 486 err = -1;