aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2009-06-13 00:27:05 -0400
committerRusty Russell <rusty@rustcorp.com.au>2009-06-12 08:57:05 -0400
commit7b5c806c35f6ff76b2e36a8b5b1513c8a83fcff7 (patch)
tree382e194aadcae193229c121c60c0d4838255c327
parente606490c440900e50ccf73a54f6fc6150ff40815 (diff)
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>
-rw-r--r--Documentation/lguest/lguest.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Documentation/lguest/lguest.c b/Documentation/lguest/lguest.c
index 8704600c5e42..02fa524cf4ad 100644
--- a/Documentation/lguest/lguest.c
+++ b/Documentation/lguest/lguest.c
@@ -836,7 +836,12 @@ static void handle_console_output(struct virtqueue *vq, bool timeout)
836 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) { 836 while ((head = get_vq_desc(vq, iov, &out, &in)) != vq->vring.num) {
837 if (in) 837 if (in)
838 errx(1, "Input buffers in output queue?"); 838 errx(1, "Input buffers in output queue?");
839 writev(STDOUT_FILENO, iov, out); 839 while (!iov_empty(iov, out)) {
840 int len = writev(STDOUT_FILENO, iov, out);
841 if (len <= 0)
842 err(1, "Write to stdout gave %i", len);
843 iov_consume(iov, out, len);
844 }
840 add_used_and_trigger(vq, head, 0); 845 add_used_and_trigger(vq, head, 0);
841 } 846 }
842} 847}