diff options
Diffstat (limited to 'tools/perf/util/util.c')
-rw-r--r-- | tools/perf/util/util.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 25822bdf7bbf..24e8d871b74e 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -456,6 +456,7 @@ int filename__read_str(const char *filename, char **buf, size_t *sizep) | |||
456 | size_t size = 0, alloc_size = 0; | 456 | size_t size = 0, alloc_size = 0; |
457 | void *bf = NULL, *nbf; | 457 | void *bf = NULL, *nbf; |
458 | int fd, n, err = 0; | 458 | int fd, n, err = 0; |
459 | char sbuf[STRERR_BUFSIZE]; | ||
459 | 460 | ||
460 | fd = open(filename, O_RDONLY); | 461 | fd = open(filename, O_RDONLY); |
461 | if (fd < 0) | 462 | if (fd < 0) |
@@ -476,8 +477,8 @@ int filename__read_str(const char *filename, char **buf, size_t *sizep) | |||
476 | n = read(fd, bf + size, alloc_size - size); | 477 | n = read(fd, bf + size, alloc_size - size); |
477 | if (n < 0) { | 478 | if (n < 0) { |
478 | if (size) { | 479 | if (size) { |
479 | pr_warning("read failed %d: %s\n", | 480 | pr_warning("read failed %d: %s\n", errno, |
480 | errno, strerror(errno)); | 481 | strerror_r(errno, sbuf, sizeof(sbuf))); |
481 | err = 0; | 482 | err = 0; |
482 | } else | 483 | } else |
483 | err = -errno; | 484 | err = -errno; |