mirror of
https://github.com/adulau/aha.git
synced 2024-12-28 11:46:19 +00:00
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>
This commit is contained in:
parent
ae07b63f4b
commit
7eac7e9e72
1 changed files with 2 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue