From patchwork Tue Jan 19 23:56:21 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juan Quintela X-Patchwork-Id: 43254 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id A744CB7CDB for ; Wed, 20 Jan 2010 11:26:48 +1100 (EST) Received: from localhost ([127.0.0.1]:42200 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXOO0-0001Ec-7g for incoming@patchwork.ozlabs.org; Tue, 19 Jan 2010 19:25:28 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NXNwP-0005yV-ST for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:57 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NXNwL-0005uZ-1e for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:56 -0500 Received: from [199.232.76.173] (port=59388 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NXNwK-0005uI-CZ for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:52 -0500 Received: from mx1.redhat.com ([209.132.183.28]:6755) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NXNwJ-0005x0-O6 for qemu-devel@nongnu.org; Tue, 19 Jan 2010 18:56:52 -0500 Received: from int-mx08.intmail.prod.int.phx2.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0JNuoLx005720 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 19 Jan 2010 18:56:50 -0500 Received: from localhost.localdomain (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx08.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0JNuT3v027975; Tue, 19 Jan 2010 18:56:49 -0500 From: Juan Quintela To: qemu-devel@nongnu.org Date: Wed, 20 Jan 2010 00:56:21 +0100 Message-Id: In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.67 on 10.5.11.21 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: kirill@shutemov.name Subject: [Qemu-devel] [PATCH 14/17] check pipe() return value X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Signed-off-by: Juan Quintela --- hw/xen_domainbuild.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/hw/xen_domainbuild.c b/hw/xen_domainbuild.c index 20d731d..2f59856 100644 --- a/hw/xen_domainbuild.c +++ b/hw/xen_domainbuild.c @@ -156,15 +156,18 @@ quit: return; } -static void xen_domain_watcher(void) +static int xen_domain_watcher(void) { int qemu_running = 1; int fd[2], i, n, rc; char byte; - pipe(fd); + if (pipe(fd) != 0) { + qemu_log("%s: Huh? pipe error: %s\n", __FUNCTION__, strerror(errno)); + return -1; + } if (fork() != 0) - return; /* not child */ + return 0; /* not child */ /* close all file handles, except stdio/out/err, * our watch pipe and the xen interface handle */ @@ -238,7 +241,9 @@ int xen_domain_build_pv(const char *kernel, const char *ramdisk, } qemu_log("xen: created domain %d\n", xen_domid); atexit(xen_domain_cleanup); - xen_domain_watcher(); + if (xen_domain_watcher() == -1) { + goto err; + } xenstore_domain_init1(kernel, ramdisk, cmdline);