Skip to contentSkip to conversation

kvm: fix kvm_check_extension() error handling

PATCH New Avi Kivity 1 participant 1 message May 11, 2009 KVM

lore
Share & tools
lore

Avi Kivity

author
#0 lore raw

PATCH 1/1 kvm: fix kvm_check_extension() error handling

If the KVM_CHECK_EXTENSION ioctl returns an error, it indicates a serious error, not that the extension is not supported. Fix kvm_check_extension() to report the error in this case.

---
 kvm-all.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
kvm-all.c +2 -1
index 0ac4b1e..241aaa2 100644
@@ -326,7 +326,8 @@ int kvm_check_extension(KVMState *s, unsigned int extension)
 
     ret = kvm_ioctl(s, KVM_CHECK_EXTENSION, extension);
     if (ret < 0) {
-        ret = 0;
+        fprintf(stderr, "KVM_CHECK_EXTENSION failed: %s\n", strerror(-ret));
+        exit(1);
     }
 
     return ret;
Signature · 1 line
1.6.0.6