diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-06-19 20:01:40 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-20 06:30:33 -0400 |
commit | eadc84cc01e04f9f74ec2de0c9355be035c7b396 (patch) | |
tree | 95e26221d3f768544e33bc6754c39e9e0452b6f3 /tools | |
parent | 92bf309a9cd5fedd6c8eefbce0b9a95ada82d0a9 (diff) |
perfcounter: Handle some IO return values
Building perfcounter tools raises the following warnings:
builtin-record.c: In function ‘atexit_header’:
builtin-record.c:464: erreur: ignoring return value of ‘pwrite’, declared with attribute warn_unused_result
builtin-record.c: In function ‘__cmd_record’:
builtin-record.c:503: erreur: ignoring return value of ‘read’, declared with attribute warn_unused_result
builtin-report.c: In function ‘__cmd_report’:
builtin-report.c:1403: erreur: ignoring return value of ‘read’, declared with attribute warn_unused_result
This patch handles these IO return values.
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <1245456100-5477-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 9 | ||||
-rw-r--r-- | tools/perf/builtin-report.c | 5 |
2 files changed, 11 insertions, 3 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index e2cebc053bd7..d7ebbd757543 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -461,7 +461,8 @@ static void atexit_header(void) | |||
461 | { | 461 | { |
462 | file_header.data_size += bytes_written; | 462 | file_header.data_size += bytes_written; |
463 | 463 | ||
464 | pwrite(output, &file_header, sizeof(file_header), 0); | 464 | if (pwrite(output, &file_header, sizeof(file_header), 0) == -1) |
465 | perror("failed to write on file headers"); | ||
465 | } | 466 | } |
466 | 467 | ||
467 | static int __cmd_record(int argc, const char **argv) | 468 | static int __cmd_record(int argc, const char **argv) |
@@ -500,7 +501,11 @@ static int __cmd_record(int argc, const char **argv) | |||
500 | } | 501 | } |
501 | 502 | ||
502 | if (!file_new) { | 503 | if (!file_new) { |
503 | read(output, &file_header, sizeof(file_header)); | 504 | if (read(output, &file_header, sizeof(file_header)) == -1) { |
505 | perror("failed to read file headers"); | ||
506 | exit(-1); | ||
507 | } | ||
508 | |||
504 | lseek(output, file_header.data_size, SEEK_CUR); | 509 | lseek(output, file_header.data_size, SEEK_CUR); |
505 | } | 510 | } |
506 | 511 | ||
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index de1b97845e9e..5eb5566f0c95 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -1400,7 +1400,10 @@ static int __cmd_report(void) | |||
1400 | exit(0); | 1400 | exit(0); |
1401 | } | 1401 | } |
1402 | 1402 | ||
1403 | read(input, &file_header, sizeof(file_header)); | 1403 | if (read(input, &file_header, sizeof(file_header)) == -1) { |
1404 | perror("failed to read file headers"); | ||
1405 | exit(-1); | ||
1406 | } | ||
1404 | 1407 | ||
1405 | if (sort__has_parent && | 1408 | if (sort__has_parent && |
1406 | !(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) { | 1409 | !(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) { |