Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTFYN-0007Ef-I9 for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:38:47 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTFYI-0007EK-6K for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:38:46 -0400 Received: from [199.232.76.173] (port=49104 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTFYI-0007EH-0o for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:38:42 -0400 Received: from mx2.redhat.com ([66.187.237.31]:42257) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTFYH-0002XY-Ee for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:38:41 -0400 From: Glauber Costa Date: Tue, 21 Jul 2009 10:45:33 -0300 Message-Id: <1248183933-20986-1-git-send-email-glommer@redhat.com> Subject: [Qemu-devel] [PATCH] fix ioctl return value List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: aliguori@us.ibm.com 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 --- 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); break; } -- 1.6.2.2