aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorPierre Habouzit <pierre.habouzit@intersec.com>2009-08-07 08:16:00 -0400
committerIngo Molnar <mingo@elte.hu>2009-08-09 06:54:39 -0400
commit7eac7e9e726c1b136bd7e0ad6671ce315f48bb18 (patch)
tree17762cc0b140096e80e6ff509cc423f8e62db7e6 /tools
parentae07b63f4b6728e1f98aa5c5416cfc1280f59f51 (diff)
perf util: Fix do_read() to fail on EOF instead of busy-looping
While toying with perf, I've noticed that perf record can easily enter a busy loop when doing something as silly as: $ perf record -A ls Yeah, do_read here really wants to read a known size, not being able to should die(), not busy-loop ;) That was the cause for the bug. Signed-off-by: Pierre Habouzit <pierre.habouzit@intersec.com> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools')
-rw-r--r--tools/perf/util/header.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c
index 95a44bcfc2dc..b92a457ca32e 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)
185 185
186 if (ret < 0) 186 if (ret < 0)
187 die("failed to read"); 187 die("failed to read");
188 if (ret == 0)
189 die("failed to read: missing data");
188 190
189 size -= ret; 191 size -= ret;
190 buf += ret; 192 buf += ret;