From mboxrd@z Thu Jan 1 00:00:00 1970 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 From: Alon Levy 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> Subject: [Qemu-devel] [PATCH v3 3/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 Cc: stefanha@linux.vnet.ibm.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 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 */ -- 1.7.9.3