summaryrefslogtreecommitdiff
path: root/backends/rng-random.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2013-04-16 15:58:16 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2013-04-16 16:10:21 -0500
commitacbbc036619092fcd2c882222e1be168bd972b3e (patch)
tree08e1c0d61e9f112187dff1878c077cd73645da52 /backends/rng-random.c
parent7dda5dc82a776a39a7996020c188eb2a29187117 (diff)
rng random backend: check for -EAGAIN errors on read
Not handling EAGAIN triggers the assert qemu/backends/rng-random.c:44:entropy_available: assertion failed: (len != -1) Aborted (core dumped) This happens when starting a guest with '-device virtio-rng-pci', issuing a 'cat /dev/hwrng' in the guest, while also doing 'cat /dev/random' on the host. Reported-by: yunpingzheng <yunzheng@redhat.com> Signed-off-by: Amit Shah <amit.shah@redhat.com> Message-id: eacda84dfaf2d99cf6d250b678be4e4d6c2088fb.1366108096.git.amit.shah@redhat.com Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'backends/rng-random.c')
-rw-r--r--backends/rng-random.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/backends/rng-random.c b/backends/rng-random.c
index d5761f2cce..830360c780 100644
--- a/backends/rng-random.c
+++ b/backends/rng-random.c
@@ -41,6 +41,9 @@ static void entropy_available(void *opaque)
ssize_t len;
len = read(s->fd, buffer, s->size);
+ if (len < 0 && errno == EAGAIN) {
+ return;
+ }
g_assert(len != -1);
s->receive_func(s->opaque, buffer, len);