From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MTFdh-0000LK-W9 for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:44:18 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MTFdd-0000Kg-SS for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:44:17 -0400 Received: from [199.232.76.173] (port=59740 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MTFdd-0000Kd-P4 for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:44:13 -0400 Received: from mx2.redhat.com ([66.187.237.31]:55763) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MTFdd-000440-6P for qemu-devel@nongnu.org; Tue, 21 Jul 2009 09:44:13 -0400 Date: Tue, 21 Jul 2009 10:51:04 -0300 From: Glauber Costa Message-ID: <20090721135104.GO4019@poweredge.glommer> References: <1248183933-20986-1-git-send-email-glommer@redhat.com> <4A65C554.3020708@us.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4A65C554.3020708@us.ibm.com> Subject: [Qemu-devel] Re: [PATCH] fix ioctl return value List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Anthony Liguori Cc: qemu-devel@nongnu.org On Tue, Jul 21, 2009 at 08:40:36AM -0500, Anthony Liguori wrote: > 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 >> --- >> 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); want me to shoot a new one?