From patchwork Tue Nov 1 19:20:27 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eduardo Habkost X-Patchwork-Id: 123128 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C6439B6F69 for ; Wed, 2 Nov 2011 06:23:29 +1100 (EST) Received: from localhost ([::1]:39775 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLJvh-0006RX-O1 for incoming@patchwork.ozlabs.org; Tue, 01 Nov 2011 15:23:25 -0400 Received: from eggs.gnu.org ([140.186.70.92]:35125) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLJuT-000396-4E for qemu-devel@nongnu.org; Tue, 01 Nov 2011 15:22:10 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLJuP-00089i-FW for qemu-devel@nongnu.org; Tue, 01 Nov 2011 15:22:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35461) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLJuO-00089P-Pk for qemu-devel@nongnu.org; Tue, 01 Nov 2011 15:22:05 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id pA1JLsaU020747 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 1 Nov 2011 15:21:54 -0400 Received: from blackpad.lan.raisama.net (ovpn-113-81.phx2.redhat.com [10.3.113.81]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id pA1JLsS1009560; Tue, 1 Nov 2011 15:21:54 -0400 Received: by blackpad.lan.raisama.net (Postfix, from userid 500) id 4124120CED2; Tue, 1 Nov 2011 17:20:31 -0200 (BRST) From: Eduardo Habkost To: qemu-devel@nongnu.org Date: Tue, 1 Nov 2011 17:20:27 -0200 Message-Id: <1320175230-27980-9-git-send-email-ehabkost@redhat.com> In-Reply-To: <1320175230-27980-1-git-send-email-ehabkost@redhat.com> References: <1320175230-27980-1-git-send-email-ehabkost@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 209.132.183.28 Cc: Michael Roth , Juan Quintela Subject: [Qemu-devel] [RFC PATCH 08/11] exec_close(): return -errno on errors X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org All qemu_fclose() callers were already changed to accept any negative value as error, so we now can change it to return -errno. When the process exits with a non-zero exit code, we return -EIO to as a fake errno value. Signed-off-by: Eduardo Habkost --- migration-exec.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/migration-exec.c b/migration-exec.c index 626b648..1e9cb1d 100644 --- a/migration-exec.c +++ b/migration-exec.c @@ -50,12 +50,9 @@ static int exec_close(MigrationState *s) ret = qemu_fclose(s->opaque); s->opaque = NULL; s->fd = -1; - if (ret >= 0 && - WIFEXITED(ret) - && WEXITSTATUS(ret) == 0) { - ret = 0; - } else { - ret = -1; + if (ret >= 0 && !(WIFEXITED(ret) && WEXITSTATUS(ret) == 0)) { + // close succeeded, but non-zero exit code: + ret = -EIO; // fake errno value } } return ret;