提交 db9eae1c 编写于 作者: X Xu He Jie 提交者: Anthony Liguori

kvm_init didn't set return value after create vm failed

And kvm_ioctl(s, KVM_CREATE_VM, 0)'s return value can be < -1,
so change the check of vmfd at label 'err'.
Signed-off-by: NXu He Jie <xuhj@linux.vnet.ibm.com>
Signed-off-by: NAnthony Liguori <aliguori@us.ibm.com>
上级 3a26360d
......@@ -740,6 +740,7 @@ int kvm_init(void)
fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
"your host kernel command line\n");
#endif
ret = s->vmfd;
goto err;
}
......@@ -798,7 +799,7 @@ int kvm_init(void)
err:
if (s) {
if (s->vmfd != -1) {
if (s->vmfd >= 0) {
close(s->vmfd);
}
if (s->fd != -1) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册