| Submitter | Xu He Jie |
|---|---|
| Date | Oct. 27, 2011, 2:15 a.m. |
| Message ID | <1319681713-17168-1-git-send-email-xuhj@linux.vnet.ibm.com> |
| Download | mbox | patch |
| Permalink | /patch/122048/ |
| State | New |
| Headers | show |
Comments
Patch
diff --git a/kvm-all.c b/kvm-all.c index e7faf5c..70edb39 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -739,6 +739,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; } @@ -797,7 +798,7 @@ int kvm_init(void) err: if (s) { - if (s->vmfd != -1) { + if (s->vmfd >= 0) { close(s->vmfd); } if (s->fd != -1) {
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: Xu He Jie <xuhj@linux.vnet.ibm.com> --- kvm-all.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletions(-)