From patchwork Wed Mar 14 13:09:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 146607 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 1C00DB6EE7 for ; Thu, 15 Mar 2012 00:10:28 +1100 (EST) Received: from localhost ([::1]:57142 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7nyD-0004Mx-D9 for incoming@patchwork.ozlabs.org; Wed, 14 Mar 2012 09:10:25 -0400 Received: from eggs.gnu.org ([208.118.235.92]:40372) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7ny1-0004Ki-Ek for qemu-devel@nongnu.org; Wed, 14 Mar 2012 09:10:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7nxw-0001kC-CL for qemu-devel@nongnu.org; Wed, 14 Mar 2012 09:10:13 -0400 Received: from mx1.redhat.com ([209.132.183.28]:20021) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7nxw-0001jb-4V for qemu-devel@nongnu.org; Wed, 14 Mar 2012 09:10:08 -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 q2EDA4E8017592 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 14 Mar 2012 09:10:04 -0400 Received: from garlic.redhat.com (vpn-200-217.tlv.redhat.com [10.35.200.217]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q2ED9nN8009520; Wed, 14 Mar 2012 09:10:02 -0400 From: Alon Levy To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Wed, 14 Mar 2012 15:09:48 +0200 Message-Id: <1331730588-19771-4-git-send-email-alevy@redhat.com> In-Reply-To: <1331730588-19771-1-git-send-email-alevy@redhat.com> References: <1331730588-19771-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: stefanha@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH v3 3/3] qxl: init_pipe_signaling: exit on failure 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 If pipe creation fails, exit, don't log and continue. Fix indentation at the same time. Signed-off-by: Alon Levy --- hw/qxl.c | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/hw/qxl.c b/hw/qxl.c index ce87160..d28c1c0 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1457,16 +1457,17 @@ static void qxl_send_events(PCIQXLDevice *d, uint32_t events) static void init_pipe_signaling(PCIQXLDevice *d) { - if (pipe(d->pipe) < 0) { - dprint(d, 1, "%s: pipe creation failed\n", __FUNCTION__); - return; - } - fcntl(d->pipe[0], F_SETFL, O_NONBLOCK); - fcntl(d->pipe[1], F_SETFL, O_NONBLOCK); - fcntl(d->pipe[0], F_SETOWN, getpid()); - - qemu_thread_get_self(&d->main); - qemu_set_fd_handler(d->pipe[0], pipe_read, NULL, d); + if (pipe(d->pipe) < 0) { + fprintf(stderr, "%s:%s: qxl pipe creation failed\n", + __FILE__, __func__); + exit(1); + } + fcntl(d->pipe[0], F_SETFL, O_NONBLOCK); + fcntl(d->pipe[1], F_SETFL, O_NONBLOCK); + fcntl(d->pipe[0], F_SETOWN, getpid()); + + qemu_thread_get_self(&d->main); + qemu_set_fd_handler(d->pipe[0], pipe_read, NULL, d); } /* graphics console */