diff options
author | James Morris <jmorris@namei.org> | 2009-08-11 08:33:01 +1000 |
---|---|---|
committer | James Morris <jmorris@namei.org> | 2009-08-11 08:33:01 +1000 |
commit | 8b4bfc7feb005d84e2bd0831d8331a304e9d6483 (patch) | |
tree | a13891d7264aefeea65e60cc956e8fa704032cd9 /tools/perf/util/header.c | |
parent | 896a6de40ef3814525632609799af909338f50c3 (diff) | |
parent | 85dfd81dc57e8183a277ddd7a56aa65c96f3f487 (diff) |
Merge branch 'master' into next
Diffstat (limited to 'tools/perf/util/header.c')
-rw-r--r-- | tools/perf/util/header.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 450384b3bbe..b92a457ca32 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c @@ -185,6 +185,8 @@ static void do_read(int fd, void *buf, size_t size) if (ret < 0) die("failed to read"); + if (ret == 0) + die("failed to read: missing data"); size -= ret; buf += ret; @@ -213,9 +215,10 @@ struct perf_header *perf_header__read(int fd) for (i = 0; i < nr_attrs; i++) { struct perf_header_attr *attr; - off_t tmp = lseek(fd, 0, SEEK_CUR); + off_t tmp; do_read(fd, &f_attr, sizeof(f_attr)); + tmp = lseek(fd, 0, SEEK_CUR); attr = perf_header_attr__new(&f_attr.attr); |