diff options
author | Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com> | 2014-08-13 22:22:43 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2014-08-15 12:07:14 -0400 |
commit | 35550da389ba8752f024a44ef14b74001c4fc4d3 (patch) | |
tree | a04c06b41e92814d62cdb56301b63a5c1b1d3741 /tools/perf | |
parent | 942a91ed3ffff0267944ed3161ae292d0960fd44 (diff) |
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>
Diffstat (limited to 'tools/perf')
-rw-r--r-- | tools/perf/builtin-record.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 4db670d4b8da..87e28a4e33ba 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -161,7 +161,7 @@ try_again: | |||
161 | 161 | ||
162 | if (perf_evlist__apply_filters(evlist)) { | 162 | if (perf_evlist__apply_filters(evlist)) { |
163 | error("failed to set filter with %d (%s)\n", errno, | 163 | error("failed to set filter with %d (%s)\n", errno, |
164 | strerror(errno)); | 164 | strerror_r(errno, msg, sizeof(msg))); |
165 | rc = -1; | 165 | rc = -1; |
166 | goto out; | 166 | goto out; |
167 | } | 167 | } |
@@ -175,7 +175,8 @@ try_again: | |||
175 | "(current value: %u)\n", opts->mmap_pages); | 175 | "(current value: %u)\n", opts->mmap_pages); |
176 | rc = -errno; | 176 | rc = -errno; |
177 | } else { | 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 | rc = -errno; | 180 | rc = -errno; |
180 | } | 181 | } |
181 | goto out; | 182 | goto out; |
@@ -480,7 +481,7 @@ static int __cmd_record(struct record *rec, int argc, const char **argv) | |||
480 | } | 481 | } |
481 | 482 | ||
482 | if (forks && workload_exec_errno) { | 483 | if (forks && workload_exec_errno) { |
483 | char msg[512]; | 484 | char msg[STRERR_BUFSIZE]; |
484 | const char *emsg = strerror_r(workload_exec_errno, msg, sizeof(msg)); | 485 | const char *emsg = strerror_r(workload_exec_errno, msg, sizeof(msg)); |
485 | pr_err("Workload failed: %s\n", emsg); | 486 | pr_err("Workload failed: %s\n", emsg); |
486 | err = -1; | 487 | err = -1; |