From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matt Evans Subject: [PATCH 08/28] kvm tools: Fix KVM_RUN exit code check Date: Tue, 06 Dec 2011 14:39:46 +1100 Message-ID: <4EDD8E82.1010909@ozlabs.org> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit To: kvm@vger.kernel.org, kvm-ppc@vger.kernel.org Return-path: In-Reply-To: Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org kvm_cpu__run() currently die()s if KVM_RUN returns non-zero. Some architectures may return positive values in non-error cases, whereas real errors are always negative return values. Check for those instead. Signed-off-by: Matt Evans --- tools/kvm/kvm-cpu.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/tools/kvm/kvm-cpu.c b/tools/kvm/kvm-cpu.c index 9bc0796..884a89f 100644 --- a/tools/kvm/kvm-cpu.c +++ b/tools/kvm/kvm-cpu.c @@ -30,7 +30,7 @@ void kvm_cpu__run(struct kvm_cpu *vcpu) int err; err = ioctl(vcpu->vcpu_fd, KVM_RUN, 0); - if (err && (errno != EINTR && errno != EAGAIN)) + if (err < 0 && (errno != EINTR && errno != EAGAIN)) die_perror("KVM_RUN failed"); }