summaryrefslogtreecommitdiffstats
path: root/nbd/server.c
diff options
context:
space:
mode:
authorVladimir Sementsov-Ogievskiy2017-06-02 17:01:43 +0200
committerPaolo Bonzini2017-06-15 11:04:06 +0200
commit572b97e7223a75c14e1620440c4f887b4e8b3da3 (patch)
tree218f4d73ffdce21b8fd58d8021fd6ede56f0b81f /nbd/server.c
parentnbd/server: get rid of ssize_t (diff)
downloadqemu-572b97e7223a75c14e1620440c4f887b4e8b3da3.tar.gz
qemu-572b97e7223a75c14e1620440c4f887b4e8b3da3.tar.xz
qemu-572b97e7223a75c14e1620440c4f887b4e8b3da3.zip
nbd/server: refactor nbd_co_send_reply
As nbd_write never returns value > 0, we can get rid of extra ret. Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com> Reviewed-by: Eric Blake <eblake@redhat.com> Message-Id: <20170602150150.258222-6-vsementsov@virtuozzo.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'nbd/server.c')
-rw-r--r--nbd/server.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/nbd/server.c b/nbd/server.c
index 895cd7f132..8ceac89a23 100644
--- a/nbd/server.c
+++ b/nbd/server.c
@@ -972,7 +972,7 @@ void nbd_export_close_all(void)
static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len)
{
NBDClient *client = req->client;
- int rc, ret;
+ int rc;
g_assert(qemu_in_coroutine());
qemu_co_mutex_lock(&client->send_lock);
@@ -983,9 +983,9 @@ static int nbd_co_send_reply(NBDRequestData *req, NBDReply *reply, int len)
} else {
qio_channel_set_cork(client->ioc, true);
rc = nbd_send_reply(client->ioc, reply);
- if (rc >= 0) {
- ret = nbd_write(client->ioc, req->data, len, NULL);
- if (ret < 0) {
+ if (rc == 0) {
+ rc = nbd_write(client->ioc, req->data, len, NULL);
+ if (rc < 0) {
rc = -EIO;
}
}