From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:39389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9FVA-000142-6U for qemu-devel@nongnu.org; Sun, 18 Mar 2012 08:46:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S9FV8-0003VN-Da for qemu-devel@nongnu.org; Sun, 18 Mar 2012 08:46:23 -0400 Received: from mx1.redhat.com ([209.132.183.28]:45728) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S9FV8-0003VB-6D for qemu-devel@nongnu.org; Sun, 18 Mar 2012 08:46:22 -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 q2ICkKPx015096 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 18 Mar 2012 08:46:20 -0400 From: Alon Levy Date: Sun, 18 Mar 2012 13:46:13 +0100 Message-Id: <1332074775-31270-2-git-send-email-alevy@redhat.com> In-Reply-To: <1332074775-31270-1-git-send-email-alevy@redhat.com> References: <1332074775-31270-1-git-send-email-alevy@redhat.com> Subject: [Qemu-devel] [PATCH v4 1/3] qxl: init_pipe_signaling: exit on failure List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, kraxel@redhat.com 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 e17b0e3..26ca893 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -1452,16 +1452,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 */ -- 1.7.9.3