coroutine-io: Return -errno in case of error
authorMax Reitz <mreitz@redhat.com>
Wed, 25 Feb 2015 18:08:28 +0000 (13:08 -0500)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 18 Mar 2015 11:07:21 +0000 (12:07 +0100)
In case qemu_co_sendv_recvv() fails without any data read, there is no
reason not to return the perfectly fine error number retrieved from
socket_error().

Signed-off-by: Max Reitz <mreitz@redhat.com>
Message-Id: <1424887718-10800-16-git-send-email-mreitz@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
qemu-coroutine-io.c

index d4049260da0381d0a1008c2f38e3ee150dae982e..28dc7351accb904b3caf204ee5032a69364dec87 100644 (file)
@@ -45,7 +45,7 @@ qemu_co_sendv_recvv(int sockfd, struct iovec *iov, unsigned iov_cnt,
             if (err == EAGAIN || err == EWOULDBLOCK) {
                 qemu_coroutine_yield();
             } else if (done == 0) {
-                return -1;
+                return -err;
             } else {
                 break;
             }