From 7798d3aab981b1ccb29ba7343368a55a32a26d30 Mon Sep 17 00:00:00 2001 From: Vladimir Sementsov-Ogievskiy Date: Fri, 2 Jun 2017 18:01:47 +0300 Subject: nbd/server: nbd_negotiate: fix error path Current code will return 0 on this nbd_write fail, as rc is 0 after successful nbd_negotiate_options. Fix this. Signed-off-by: Vladimir Sementsov-Ogievskiy Reviewed-by: Eric Blake Message-Id: <20170602150150.258222-10-vsementsov@virtuozzo.com> Signed-off-by: Paolo Bonzini --- nbd/server.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'nbd') diff --git a/nbd/server.c b/nbd/server.c index d52682741f..c9ca847021 100644 --- a/nbd/server.c +++ b/nbd/server.c @@ -607,7 +607,8 @@ static coroutine_fn int nbd_negotiate(NBDClient *client) stq_be_p(buf + 18, client->exp->size); stw_be_p(buf + 26, client->exp->nbdflags | myflags); len = client->no_zeroes ? 10 : sizeof(buf) - 18; - if (nbd_write(client->ioc, buf + 18, len, NULL) < 0) { + rc = nbd_write(client->ioc, buf + 18, len, NULL); + if (rc < 0) { LOG("write failed"); goto fail; } -- cgit v1.2.3