qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] Re: [PATCH] fix ioctl return value


From: Anthony Liguori
Subject: [Qemu-devel] Re: [PATCH] fix ioctl return value
Date: Tue, 21 Jul 2009 08:40:36 -0500
User-agent: Thunderbird 2.0.0.21 (X11/20090320)

Glauber Costa wrote:
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.

Signed-off-by: Glauber Costa <address@hidden>
---
 kvm-all.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/kvm-all.c b/kvm-all.c
index 8567ac9..9a79466 100644
--- a/kvm-all.c
+++ b/kvm-all.c
@@ -319,9 +319,8 @@ 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;
+        if ((ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d)) < 0) {
+            dprintf("ioctl failed %d\n", ret);

While this is fine, I usually prefer:

ret = kvm_vm_ioctl(s, KVM_GET_DIRTY_LOG, &d);
if (ret < 0) {
   dprintf(ioctl failed %d\n", ret);

--
Regards,

Anthony Liguori





reply via email to

[Prev in Thread] Current Thread [Next in Thread]