aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf/util/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r--tools/perf/util/header.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 212fade7ee74..9aae360c0f28 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -287,10 +287,16 @@ struct perf_header *perf_header__read(int fd)
287 do_read(fd, &f_header, sizeof(f_header)); 287 do_read(fd, &f_header, sizeof(f_header));
288 288
289 if (f_header.magic != PERF_MAGIC || 289 if (f_header.magic != PERF_MAGIC ||
290 f_header.size != sizeof(f_header) ||
291 f_header.attr_size != sizeof(f_attr)) 290 f_header.attr_size != sizeof(f_attr))
292 die("incompatible file format"); 291 die("incompatible file format");
293 292
293 if (f_header.size != sizeof(f_header)) {
294 /* Support the previous format */
295 if (f_header.size == offsetof(typeof(f_header), trace_info))
296 f_header.trace_info.size = 0;
297 else
298 die("incompatible file format");
299 }
294 nr_attrs = f_header.attrs.size / sizeof(f_attr); 300 nr_attrs = f_header.attrs.size / sizeof(f_attr);
295 lseek(fd, f_header.attrs.offset, SEEK_SET); 301 lseek(fd, f_header.attrs.offset, SEEK_SET);
296 302