提交 7798d3aa 编写于 作者: V Vladimir Sementsov-Ogievskiy 提交者: Paolo Bonzini

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: NVladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: NEric Blake <eblake@redhat.com>
Message-Id: <20170602150150.258222-10-vsementsov@virtuozzo.com>
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 c84087f2
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册