Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTFsG-0000XT-BT for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:59:20 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTFsB-0000Hs-Ow for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:59:19 -0400 Received: from [199.232.76.173] (port=40769 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTFsB-0000H9-FR for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:59:15 -0400 Received: from mx2.redhat.com ([66.187.237.31]:47274) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTFsA-0007LN-Qx for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:59:15 -0400 From: Glauber Costa Date: Tue, 21 Jul 2009 11:06:06 -0300 Message-Id: <1248185166-21642-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 | 6 +++--- 1 files changed, 3 insertions(+), 3 deletions(-) diff --git a/kvm-all.c b/kvm-all.c index 8567ac9..2f74dcb 100644 --- a/kvm-all.c +++ b/kvm-all.c @@ -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; } -- 1.6.2.2