提交 7eac7e9e 编写于 作者: P Pierre Habouzit 提交者: Ingo Molnar

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: NPierre Habouzit <pierre.habouzit@intersec.com>
Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Paul Mackerras <paulus@samba.org>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 ae07b63f
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册