Skip to contentSkip to conversation

fix ioctl return value

PATCH New Glauber Costa 1 participant 1 message Jul 21, 2009

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix ioctl return value

we expect a number less than 0, not exactly -1.
And furthermore, we return errno itself, so no need to use it.

This might break guests when this ioctl fails for some reason.

---
 kvm-all.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
kvm-all.c +3 -3
index 8567ac9..2f74dcb 100644
@@ -319,9 +319,9 @@ int kvm_physical_sync_dirty_bitmap(target_phys_addr_t start_addr,
 
         d.slot = mem->slot;
 
-        if (kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d) == -1) {
-            dprintf("ioctl failed %d\n", errno);
-            ret = -1;
+        ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
+        if (ret < 0) {
+            dprintf("ioctl failed %d\n", ret);
             break;
         }
 
Signature · 1 line
1.6.2.2