diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 0bb830f6b49c..61c54213704b 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -2327,7 +2327,8 @@ int perf_session__write_header(struct perf_session *session, } } - header->data_offset = lseek(fd, 0, SEEK_CUR); + if (!header->data_offset) + header->data_offset = lseek(fd, 0, SEEK_CUR); header->feat_offset = header->data_offset + header->data_size; if (at_exit) {