summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/builtin-record.c9
-rw-r--r--tools/perf/builtin-report.c5
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)
{
file_header.data_size += bytes_written;
- pwrite(output, &file_header, sizeof(file_header), 0);
+ if (pwrite(output, &file_header, sizeof(file_header), 0) == -1)
+ perror("failed to write on file headers");
}
static int __cmd_record(int argc, const char **argv)
@@ -500,7 +501,11 @@ static int __cmd_record(int argc, const char **argv)
}
if (!file_new) {
- read(output, &file_header, sizeof(file_header));
+ if (read(output, &file_header, sizeof(file_header)) == -1) {
+ perror("failed to read file headers");
+ exit(-1);
+ }
+
lseek(output, file_header.data_size, SEEK_CUR);
}
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)
exit(0);
}
- read(input, &file_header, sizeof(file_header));
+ if (read(input, &file_header, sizeof(file_header)) == -1) {
+ perror("failed to read file headers");
+ exit(-1);
+ }
if (sort__has_parent &&
!(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) {
OpenPOWER on IntegriCloud