mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-03 17:40:04 +00:00
lguest: fix writev returning short on console output
I've never seen it here, but I can't find anywhere that says writev will write everything. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
e606490c44
commit
7b5c806c35
1 changed files with 6 additions and 1 deletions
|
@ -836,7 +836,12 @@ static void handle_console_output(struct virtqueue *vq, bool timeout)
|
|||
while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
|
||||
if (in)
|
||||
errx(1, "Input buffers in output queue?");
|
||||
writev(STDOUT_FILENO, iov, out);
|
||||
while (!iov_empty(iov, out)) {
|
||||
int len = writev(STDOUT_FILENO, iov, out);
|
||||
if (len <= 0)
|
||||
err(1, "Write to stdout gave %i", len);
|
||||
iov_consume(iov, out, len);
|
||||
}
|
||||
add_used_and_trigger(vq, head, 0);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue