From: Adrian Hunter <adrian.hun...@intel.com>

It will be necessary to predetermine header->data_offset
to allow space for attributes that are added later.
Consequently, do not change header->data_offset if it
is non-zero.

Signed-off-by: Adrian Hunter <adrian.hun...@intel.com>
---
 tools/perf/util/header.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 49c4896..0114f0a 100644
--- a/tools/perf/util/header.c
+++ b/tools/perf/util/header.c
@@ -2368,7 +2368,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) {
-- 
1.8.5.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to