diff mbox

[v1,09/21] io: add missing EWOULDBLOCK checks in Win32 I/O code paths

Message ID 1457544504-8548-10-git-send-email-berrange@redhat.com
State New
Headers show

Commit Message

Daniel P. Berrangé March 9, 2016, 5:28 p.m. UTC
On Win32 EWOULDBLOCK is not the same as EAGAIN, so we must
check both errnos after send/recv. Some places already
checked both, a couple of cases were previously missed.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
---
 io/channel-socket.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/io/channel-socket.c b/io/channel-socket.c
index 5f087e6..1de5cc0 100644
--- a/io/channel-socket.c
+++ b/io/channel-socket.c
@@ -559,7 +559,8 @@  static ssize_t qio_channel_socket_readv(QIOChannel *ioc,
                    iov[i].iov_len,
                    0);
         if (ret < 0) {
-            if (socket_error() == EAGAIN) {
+            if (socket_error() == EAGAIN ||
+                socket_error() == EWOULDBLOCK) {
                 if (done) {
                     return done;
                 } else {
@@ -601,7 +602,8 @@  static ssize_t qio_channel_socket_writev(QIOChannel *ioc,
                    iov[i].iov_len,
                    0);
         if (ret < 0) {
-            if (socket_error() == EAGAIN) {
+            if (socket_error() == EAGAIN ||
+                socket_error() == EWOULDBLOCK) {
                 if (done) {
                     return done;
                 } else {