diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 0bb830f6b49c47d0110a0bf6fa6d8bf9122c2106..61c54213704b812d2dca1ac824029ebd0c7848e6 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) {