Commit 7b5c806c authored by Rusty Russell's avatar Rusty Russell

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: default avatarRusty Russell <rusty@rustcorp.com.au>
parent e606490c
...@@ -836,7 +836,12 @@ static void handle_console_output(struct virtqueue *vq, bool timeout) ...@@ -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) { while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
if (in) if (in)
errx(1, "Input buffers in output queue?"); 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); add_used_and_trigger(vq, head, 0);
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment