From 591a89c9d2d0b0581742a13cd95a6457810597cf Mon Sep 17 00:00:00 2001 From: Marek Marczykowski Date: Sat, 25 Aug 2012 01:22:00 +0200 Subject: [PATCH] vm/filecopy: support nonblocking fd in read_all This will be needed to (non blocking) check if data is available on pipe - especially to receive possible error from the other end (which will be introduced sometime later). --- qubes_rpc/ioall.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/qubes_rpc/ioall.c b/qubes_rpc/ioall.c index 355b88f..2a81df4 100644 --- a/qubes_rpc/ioall.c +++ b/qubes_rpc/ioall.c @@ -75,9 +75,14 @@ int read_all(int fd, void *buf, int size) return 0; } if (ret < 0) { - perror_wrapper("read"); + if (errno != EAGAIN) + perror_wrapper("read"); return 0; } + if (got_read == 0) { + // force blocking operation on further reads + set_block(fd); + } got_read += ret; } // fprintf(stderr, "read %d bytes\n", size);