aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-record.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/builtin-record.c')
-rw-r--r--tools/perf/builtin-record.c9
1 files changed, 7 insertions, 2 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
467static int __cmd_record(int argc, const char **argv) 468static 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