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: Xu He Jie <xuhj@linux.vnet.ibm.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
fprintf(stderr, "Please add the 'switch_amode' kernel parameter to "
"your host kernel command line\n");
#endif
+ ret = s->vmfd;
goto err;
}
err:
if (s) {
- if (s->vmfd != -1) {
+ if (s->vmfd >= 0) {
close(s->vmfd);
}
if (s->fd != -1) {