From: Paolo Bonzini Date: Wed, 9 Jul 2014 09:53:09 +0000 (+0200) Subject: qemu-coroutine-io: fix for Win32 X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~633^2~15 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=79d9b6566b90efac072720f37a1b57d73f539264;p=sdk%2Femulator%2Fqemu.git qemu-coroutine-io: fix for Win32 Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi --- diff --git a/nbd.c b/nbd.c index e7d1cee..5c28f71 100644 --- a/nbd.c +++ b/nbd.c @@ -156,7 +156,7 @@ ssize_t nbd_wr_sync(int fd, void *buffer, size_t size, bool do_read) err = socket_error(); /* recoverable error */ - if (err == EINTR || (offset > 0 && err == EAGAIN)) { + if (err == EINTR || (offset > 0 && (err == EAGAIN || err == EWOULDBLOCK))) { continue; } diff --git a/qemu-coroutine-io.c b/qemu-coroutine-io.c index 054ca70..d404926 100644 --- a/qemu-coroutine-io.c +++ b/qemu-coroutine-io.c @@ -34,13 +34,15 @@ qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cnt, { size_t done = 0; ssize_t ret; + int err; while (done < bytes) { ret = iov_send_recv(sockfd, iov, iov_cnt, offset + done, bytes - done, do_send); if (ret > 0) { done += ret; } else if (ret < 0) { - if (errno == EAGAIN) { + err = socket_error(); + if (err == EAGAIN || err == EWOULDBLOCK) { qemu_coroutine_yield(); } else if (done == 0) { return -1;